bpf.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 0/3] bpf: Make sleepable arena paths use sleepable alloc_pages
@ 2026-08-24  8:25 Emil Tsalapatis
  2026-08-24  8:25 ` [PATCH 1/3] bpf: Factor out nonsleepable arena allocation logic Emil Tsalapatis
                   ` (2 more replies)
  0 siblings, 3 replies; 10+ messages in thread
From: Emil Tsalapatis @ 2026-08-24  8:25 UTC (permalink / raw)
  To: bpf; +Cc: ast, andrii, memxor, daniel, eddyz87, Emil Tsalapatis

The arena_alloc_pages() call takes a sleepable argument based on whether
its caller is a sleepable BPF function. This flag, along with the context
the kfunc is called in, decides whether the call will try to fulfill the
allocation using the regular or the _nolock variant of the alloc_pages
API, by means of bpf_map_alloc_pages().

However, the arena_alloc_pages() call currently only makes allocations
inside an IRQ-disabled critical section. This forces all allocations to
use the _nolock() API, which may eagerly fail where the regular variant
would eventually succeed. There have been reports of this happening for
sched-ext schedulers.

Restructure arena_alloc_pages() to use the _nolock() page allocation API
only when necessary. This requires moving allocations outside of the 
spinlock critical section for sleepable calls, which in turn requires
slightly different logic in the allocation path. Make a separate
sleepable code path that implements this logic.

Signed-off-by: Emil Tsalapatis <emil@etsalapatis.com>

Emil Tsalapatis (3):
  bpf: Factor out nonsleepable arena allocation logic
  bpf: Add sleepable arena page allocation path
  selftests/bpf: Test large allocations for both sleepable/nonsleepable
    arena users

 include/linux/bpf.h                           |   6 +
 kernel/bpf/arena.c                            | 188 +++++++++++++-----
 kernel/bpf/syscall.c                          |   8 +-
 .../bpf/progs/verifier_arena_large.c          |  27 ++-
 4 files changed, 175 insertions(+), 54 deletions(-)

-- 
2.54.0


^ permalink raw reply	[flat|nested] 10+ messages in thread

end of thread, other threads:[~2026-08-26  1:25 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-08-24  8:25 [PATCH 0/3] bpf: Make sleepable arena paths use sleepable alloc_pages Emil Tsalapatis
2026-08-24  8:25 ` [PATCH 1/3] bpf: Factor out nonsleepable arena allocation logic Emil Tsalapatis
2026-08-24  9:24   ` bot+bpf-ci
2026-08-24  8:25 ` [PATCH 2/3] bpf: Add sleepable arena page allocation path Emil Tsalapatis
2026-08-24  8:43   ` sashiko-bot
2026-08-24  9:42   ` bot+bpf-ci
2026-08-26  1:25   ` Alexei Starovoitov
2026-08-24  8:25 ` [PATCH 3/3] selftests/bpf: Test large allocations for both sleepable/nonsleepable arena users Emil Tsalapatis
2026-08-24  8:39   ` sashiko-bot
2026-08-24  9:24   ` bot+bpf-ci

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).