]> git.ipfire.org Git - thirdparty/kernel/linux.git/commit
bpf: Use kmalloc_nolock() in bpf streams
authorPuranjay Mohan <puranjay@kernel.org>
Thu, 23 Oct 2025 16:14:44 +0000 (16:14 +0000)
committerAlexei Starovoitov <ast@kernel.org>
Thu, 30 Oct 2025 01:19:46 +0000 (18:19 -0700)
commit5701d5aefa19a48c4eb14625a740027ac82657f8
treeae7d929b151d6dd684ce8c4e9f7c99581da1aaf2
parentd28c0e49210b585c6f995eeb80b3df500e488a58
bpf: Use kmalloc_nolock() in bpf streams

BPF stream kfuncs need to be non-sleeping as they can be called from
programs running in any context, this requires a way to allocate memory
from any context. Currently, this is done by a custom per-CPU NMI-safe
bump allocation mechanism, backed by alloc_pages_nolock() and
free_pages_nolock() primitives.

As kmalloc_nolock() and kfree_nolock() primitives are available now, the
custom allocator can be removed in favor of these.

Signed-off-by: Puranjay Mohan <puranjay@kernel.org>
Acked-by: Kumar Kartikeya Dwivedi <memxor@gmail.com>
Link: https://lore.kernel.org/r/20251023161448.4263-1-puranjay@kernel.org
Signed-off-by: Alexei Starovoitov <ast@kernel.org>
kernel/bpf/stream.c