Message ID | 20220318045553.3091807-1-joannekoong@fb.com (mailing list archive) |
---|---|
Headers | show |
Series | Enable non-atomic allocations in local storage | expand |
Hello: This series was applied to bpf/bpf-next.git (master) by Alexei Starovoitov <ast@kernel.org>: On Thu, 17 Mar 2022 21:55:51 -0700 you wrote: > 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. > > [...] Here is the summary with links: - [bpf-next,v3,1/2] bpf: Enable non-atomic allocations in local storage https://git.kernel.org/bpf/bpf-next/c/b00fa38a9c1c - [bpf-next,v3,2/2] selftests/bpf: Test for associating multiple elements with the local storage https://git.kernel.org/bpf/bpf-next/c/0e790cbb1af9 You are awesome, thank you!
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(-)