From: "Emil Tsalapatis" <emil@etsalapatis.com>
To: "Alexei Starovoitov" <alexei.starovoitov@gmail.com>,
"Emil Tsalapatis" <emil@etsalapatis.com>, <bpf@vger.kernel.org>
Cc: <andrii@kernel.org>, <eddyz87@gmail.com>, <memxor@gmail.com>,
<daniel@iogearbox.net>
Subject: Re: [PATCH bpf v3 3/7] bpf: Add sleepable arena page allocation path
Date: Fri, 25 Sep 2026 21:57:04 +0000 [thread overview]
Message-ID: <DLOQESM8SNGA.2ASMGV6KHJ4WB@etsalapatis.com> (raw)
In-Reply-To: <DLOPQUOW1A97.1KXFXSEUUNSFT@gmail.com>
On Fri Sep 25, 2026 at 9:25 PM UTC, Alexei Starovoitov wrote:
> On Fri, Sep 25, 2026 at 08:39 PM Emil Tsalapatis <emil@etsalapatis.com> wrote:
>> Since allocation now happens before range-tree arbitration, concurrent
>> callers can allocate pages for competing requests. Bound the aggregate
>> number of pages in this pre-arbitration window to the configured maximum
>> size of the arena.
>
> The pages are allocated with __GFP_ACCOUNT. memcg bounds them already.
> Let's drop nr_pages_inflight. Seems like unnecessary complication.
>
The nr_pages_in_flight is there for the edge case where multiple concurrent
allocations in the arena inflate memcg usage close to the limit, then a non-arena
related allocation fails/triggers OOM. If we're fine with that happy to remove
it since it's a bit of a tacked-on hack.
I'll replace it with __GFP_RETRY_MAYFAIL on alloc_pages() so that the allocation
doesn't accidentally trigger the OOM killer. AFAICT it can do so otherwise.
>> +out_unmap:
>> + if (sleepable)
>> + flush_vmap_cache(kern_vm_start + uaddr32, mapped << PAGE_SHIFT);
>> range_tree_set(&arena->rt, pgoff + mapped, page_cnt - mapped);
>> raw_res_spin_unlock_irqrestore(&arena->spinlock, flags);
>> - if (mapped) {
>> - flush_vmap_cache(kern_vm_start + uaddr32, mapped << PAGE_SHIFT);
>> + if (mapped || sleepable) {
>> + if (!sleepable)
>> + flush_vmap_cache(kern_vm_start + uaddr32, mapped << PAGE_SHIFT);
>> arena_free_pages(arena, uaddr32, mapped, sleepable);
>> }
>
> v2 leftovers? It doesn't depend on sleepable ?
Yes, I will remove that part.
>
> pw-bot: cr
next prev parent reply other threads:[~2026-09-25 21:57 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-09-25 20:39 [PATCH bpf v3 0/7] Make sleepable arena paths use sleepable alloc_pages Emil Tsalapatis
2026-09-25 20:39 ` [PATCH bpf v3 1/7] bpf: Use an llist for page allocations Emil Tsalapatis
2026-09-25 20:39 ` [PATCH bpf v3 2/7] bpf: Add sleepable argument to bpf_alloc_pages() Emil Tsalapatis
2026-09-25 20:39 ` [PATCH bpf v3 3/7] bpf: Add sleepable arena page allocation path Emil Tsalapatis
2026-09-25 21:25 ` Alexei Starovoitov
2026-09-25 21:57 ` Emil Tsalapatis [this message]
2026-09-26 7:47 ` Alexei Starovoitov
2026-09-25 20:39 ` [PATCH bpf v3 4/7] selftests/bpf: Test large allocations for both sleepable/nonsleepable arena users Emil Tsalapatis
2026-09-25 20:39 ` [PATCH bpf v3 5/7] bpf: Support call-site kfunc specialization for near calls Emil Tsalapatis
2026-09-25 20:39 ` [PATCH bpf v3 6/7] bpf: Support call-site kfunc specialization for far calls Emil Tsalapatis
2026-09-25 20:39 ` [PATCH bpf v3 7/7] selftests/bpf: Test per-call site function specialization Emil Tsalapatis
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=DLOQESM8SNGA.2ASMGV6KHJ4WB@etsalapatis.com \
--to=emil@etsalapatis.com \
--cc=alexei.starovoitov@gmail.com \
--cc=andrii@kernel.org \
--cc=bpf@vger.kernel.org \
--cc=daniel@iogearbox.net \
--cc=eddyz87@gmail.com \
--cc=memxor@gmail.com \
/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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.