From: Joanne Koong <joannekoong@fb.com>
To: <bpf@vger.kernel.org>
Cc: <kafai@fb.com>, <kpsingh@kernel.org>, <memxor@gmail.com>,
<ast@kernel.org>, <daniel@iogearbox.net>, <andrii@kernel.org>,
<tj@kernel.org>, <davemarchevsky@fb.com>,
Joanne Koong <joannelkoong@gmail.com>
Subject: [PATCH bpf-next v3 0/2] Enable non-atomic allocations in local storage
Date: Thu, 17 Mar 2022 21:55:51 -0700 [thread overview]
Message-ID: <20220318045553.3091807-1-joannekoong@fb.com> (raw)
From: Joanne Koong <joannelkoong@gmail.com>
Currently, local storage memory can only be allocated atomically
(GFP_ATOMIC). This restriction is too strict for sleepable bpf
programs.
In this patchset, sleepable programs can allocate memory in local
storage using GFP_KERNEL, while non-sleepable programs always default to
GFP_ATOMIC.
v3 <- v2:
* Add extra case to local_storage.c selftest to test associating multiple
elements with the local storage, which triggers a GFP_KERNEL allocation in
local_storage_update().
* Cast gfp_t to __s32 in verifier to fix the sparse warnings
v2 <- v1:
* Allocate the memory before/after the raw_spin_lock_irqsave, depending
on the gfp flags
* Rename mem_flags to gfp_flags
* Reword the comment "*mem_flags* is set by the bpf verifier" to
"*gfp_flags* is a hidden argument provided by the verifier"
* Add a sentence to the commit message about existing local storage
selftests covering both the GFP_ATOMIC and GFP_KERNEL paths in
bpf_local_storage_update.
Joanne Koong (2):
bpf: Enable non-atomic allocations in local storage
selftests/bpf: Test for associating multiple elements with the local
storage
include/linux/bpf_local_storage.h | 7 ++-
kernel/bpf/bpf_inode_storage.c | 9 +--
kernel/bpf/bpf_local_storage.c | 58 ++++++++++++-------
kernel/bpf/bpf_task_storage.c | 10 ++--
kernel/bpf/verifier.c | 20 +++++++
net/core/bpf_sk_storage.c | 21 ++++---
.../selftests/bpf/progs/local_storage.c | 19 ++++++
7 files changed, 103 insertions(+), 41 deletions(-)
--
2.30.2
next reply other threads:[~2022-03-18 4:56 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-03-18 4:55 Joanne Koong [this message]
2022-03-18 4:55 ` [PATCH bpf-next v3 1/2] bpf: Enable non-atomic allocations in local storage Joanne Koong
2022-03-18 4:55 ` [PATCH bpf-next v3 2/2] selftests/bpf: Test for associating multiple elements with the " Joanne Koong
2022-03-21 2:00 ` [PATCH bpf-next v3 0/2] Enable non-atomic allocations in " patchwork-bot+netdevbpf
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=20220318045553.3091807-1-joannekoong@fb.com \
--to=joannekoong@fb.com \
--cc=andrii@kernel.org \
--cc=ast@kernel.org \
--cc=bpf@vger.kernel.org \
--cc=daniel@iogearbox.net \
--cc=davemarchevsky@fb.com \
--cc=joannelkoong@gmail.com \
--cc=kafai@fb.com \
--cc=kpsingh@kernel.org \
--cc=memxor@gmail.com \
--cc=tj@kernel.org \
/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