From: Hans Montero <hansmontero99@gmail.com>
To: bpf@vger.kernel.org, netdev@vger.kernel.org
Cc: hjm2133@columbia.edu, sdf@google.com, ppenkov@google.com
Subject: [RFC PATCH bpf-next 0/2] bpf: Implement shared persistent fast(er) sk_storoage mode
Date: Mon, 23 Aug 2021 17:52:50 -0400 [thread overview]
Message-ID: <20210823215252.15936-1-hansmontero99@gmail.com> (raw)
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
next reply other threads:[~2021-08-23 21:53 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-08-23 21:52 Hans Montero [this message]
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
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20210823215252.15936-1-hansmontero99@gmail.com \
--to=hansmontero99@gmail.com \
--cc=bpf@vger.kernel.org \
--cc=hjm2133@columbia.edu \
--cc=netdev@vger.kernel.org \
--cc=ppenkov@google.com \
--cc=sdf@google.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox