Skip to content

RFC bpf: Implement shared persistent fast(er) sk_storoage mode

Hans Montero bpf netdev oe-kbuild-all 1 version In review

Get series with b4
b4 am [email protected]

Versions newest first

  1. v1 RFC Latest2 patches 3 repliesIn review

Patches in v1 No applies recorded yet

#Subject and filesSizeRepliesApplied
1/2bpf: Implement shared sk_storage optimizationinclude/net/sock.h include/uapi/linux/bpf.h kernel/bpf/Kconfig +2 more+68 -20 replies
2/2selftests/bpf: Extend tests for shared sk_storagetools/testing/selftests/bpf/config tools/testing/selftests/bpf/prog_tests/bpf_iter.c tools/testing/selftests/bpf/prog_tests/test_local_storage.c +2 more+88 -40 replies

Reviews trailers per patch

No Reviewed-by, Acked-by or Tested-by trailers for v1 yet.

Read the v1 thread

Cover letter [RFC PATCH bpf-next 0/2] bpf: Implement shared persistent fast(er) sk_storoage mode

From: Hans Montero <[email protected]>

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(-)
Signature · 1 line
2.30.2