diff options
| author | Emil Tsalapatis <emil@etsalapatis.com> | 2026-10-02 10:52:13 +0000 |
|---|---|---|
| committer | Alexei Starovoitov <ast@kernel.org> | 2026-10-02 13:00:59 +0000 |
| commit | cbe7d2bf7355416815c878e839d03028f4724dfb (patch) | |
| tree | 86582d61c9752b78de1ac8e45f7e3e986e9abd09 /include | |
| parent | 11de29f38a3455e5785c5fd5f38d93c413c5e822 (diff) | |
| download | linux-next-cbe7d2bf7355416815c878e839d03028f4724dfb.tar.gz linux-next-cbe7d2bf7355416815c878e839d03028f4724dfb.zip | |
bpf: Add sleepable argument to bpf_alloc_pages()
bpf_alloc_pages() currently decides whether it may use the
blocking page allocator from the current execution context
alone. Let callers further restrict that choice by passing
whether their context is sleepable.
Use the blocking allocator only when both the caller and
runtime context allow sleeping. Add __GFP_RETRY_MAYFAIL so
this path can reclaim without invoking the OOM killer when
the allocation is charged to another memcg. Existing
non-sleepable callers retain the no-lock allocation behavior.
Signed-off-by: Emil Tsalapatis <emil@etsalapatis.com>
Signed-off-by: Alexei Starovoitov <ast@kernel.org>
Link: https://patch.msgid.link/20261002105218.6171-3-emil@etsalapatis.com
Diffstat (limited to 'include')
| -rw-r--r-- | include/linux/bpf.h | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/include/linux/bpf.h b/include/linux/bpf.h index 904b539810c7..670eb9f3f20a 100644 --- a/include/linux/bpf.h +++ b/include/linux/bpf.h @@ -2902,9 +2902,9 @@ struct bpf_map *bpf_map_get_curr_or_next(u32 *id); struct bpf_prog *bpf_prog_get_curr_or_next(u32 *id); -struct page *bpf_alloc_page(int nid); +struct page *bpf_alloc_page(int nid, bool sleepable); int bpf_alloc_pages(int nid, unsigned long nr_pages, - struct llist_head *pages); + struct llist_head *pages, bool sleepable); void bpf_free_pages(struct llist_head *pages); #ifdef CONFIG_MEMCG void bpf_map_memcg_enter(const struct bpf_map *map, struct mem_cgroup **old_memcg, |
