netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [RFC PATCH bpf-next 0/2] bpf: Implement shared persistent fast(er) sk_storoage mode
@ 2021-08-23 21:52 Hans Montero
  2021-08-23 21:52 ` [RFC PATCH bpf-next 1/2] bpf: Implement shared sk_storage optimization Hans Montero
                   ` (2 more replies)
  0 siblings, 3 replies; 6+ messages in thread
From: Hans Montero @ 2021-08-23 21:52 UTC (permalink / raw)
  To: bpf, netdev; +Cc: hjm2133, sdf, ppenkov

From: Hans Montero <hjm2133@columbia.edu>

This patch set adds a BPF local storage optimization. The first patch adds the
feature, and the second patch extends the bpf selftests so that the feature is
tested.

We are running BPF programs for each egress packet and noticed that
bpf_sk_storage_get incurs a significant amount of cpu time. By inlining the
storage into struct sock and accessing that instead of performing a map lookup,
we expect to reduce overhead for our specific use-case. This also has a
side-effect of persisting the socket storage, which can be beneficial.

This optimization is disabled by default and can be enabled by setting
CONFIG_BPF_SHARED_LOCAL_STORAGE_SIZE, the byte length of the inline buffer, to
a non-zero number.

Hans Montero (2):
  bpf: Implement shared sk_storage optimization
  selftests/bpf: Extend tests for shared sk_storage

 include/net/sock.h                            |  3 ++
 include/uapi/linux/bpf.h                      |  6 +++
 kernel/bpf/Kconfig                            | 11 +++++
 kernel/bpf/bpf_local_storage.c                |  3 +-
 net/core/bpf_sk_storage.c                     | 47 ++++++++++++++++++-
 tools/testing/selftests/bpf/config            |  1 +
 .../selftests/bpf/prog_tests/bpf_iter.c       | 31 +++++++++++-
 .../bpf/prog_tests/test_local_storage.c       |  3 ++
 .../progs/bpf_iter_bpf_sk_storage_helpers.c   | 27 ++++++++++-
 .../selftests/bpf/progs/local_storage.c       | 30 ++++++++++++
 10 files changed, 156 insertions(+), 6 deletions(-)

-- 
2.30.2


^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2021-08-24 22:15 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2021-08-23 21:52 [RFC PATCH bpf-next 0/2] bpf: Implement shared persistent fast(er) sk_storoage mode Hans Montero
2021-08-23 21:52 ` [RFC PATCH bpf-next 1/2] bpf: Implement shared sk_storage optimization Hans Montero
2021-08-23 21:52 ` [RFC PATCH bpf-next 2/2] selftests/bpf: Extend tests for shared sk_storage Hans Montero
2021-08-24  0:38 ` [RFC PATCH bpf-next 0/2] bpf: Implement shared persistent fast(er) sk_storoage mode Alexei Starovoitov
2021-08-24 16:03   ` sdf
2021-08-24 22:15     ` Alexei Starovoitov

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).