All of lore.kernel.org
 help / color / mirror / Atom feed
From: "Alexei Starovoitov" <alexei.starovoitov@gmail.com>
To: "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-next v3 5/7] selftests/bpf: libarena: Refill local caches in batches
Date: Tue, 27 Oct 2026 19:50:59 +0000	[thread overview]
Message-ID: <DMFVROPTON36.3LX4QMXFDA91K@gmail.com> (raw)
In-Reply-To: <20261023002056.6647-6-emil@etsalapatis.com>

On Thu, Oct 22, 2026 at 05:20 PM Emil Tsalapatis <emil@etsalapatis.com> wrote:
> +	if (buddy_alloc_bulk(buddy, size, BUDDY_CACHE_BATCH_ORDER,
> +			     (void __arena * __arena *)slots->objects))
> +		return NULL;

This asks for one block of order + 3. When the existing chunks have free
objects of this order, but no such block, it goes to buddy_chunk_get().
Before this patch the existing chunks served such buddy_alloc().

A sleepable prog takes another 1 MiB chunk.
A non-sleepable prog loses 1 MiB of buddy->vaddr in every buddy_alloc():

  buddy_alloc()                       the cache is empty
    buddy_cache_refill()
      buddy_alloc_bulk()              no free block of order + 3
        buddy_chunk_get()
          buddy_alloc_arena_vaddr()   buddy->vaddr += 1 MiB
          bpf_arena_free_pages()      deferred to a worker
          bpf_arena_alloc_pages()     the range is still reserved: NULL
    buddy_alloc_memory()              one object from the existing chunks
                                      the cache is still empty

After 1024 of them buddy_alloc_arena_vaddr() fails for sleepable progs
too.

Should the refill look at the existing chunks only,
like buddy_alloc_nogrow() in your other series?

  reply	other threads:[~2026-10-27 19:51 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-10-23  0:20 [PATCH bpf-next v3 0/7] bpf libarena allocator improvements Emil Tsalapatis
2026-10-23  0:20 ` [PATCH bpf-next v3 1/7] selftests/bpf: libarena: Add bulk buddy allocation helpers Emil Tsalapatis
2026-10-23  0:49   ` bot+bpf-ci
2026-10-23  0:20 ` [PATCH bpf-next v3 2/7] selftests/bpf: Add a parallel buddy allocator benchmark Emil Tsalapatis
2026-10-23  0:20 ` [PATCH bpf-next v3 3/7] selftests/bpf: libarena: Add buddy per-CPU caches Emil Tsalapatis
2026-10-23  0:49   ` bot+bpf-ci
2026-10-23  0:20 ` [PATCH bpf-next v3 4/7] selftests/bpf: libarena: Handle NMI reentrancy Emil Tsalapatis
2026-10-27 19:49   ` Alexei Starovoitov
2026-10-27 21:03     ` Emil Tsalapatis
2026-10-23  0:20 ` [PATCH bpf-next v3 5/7] selftests/bpf: libarena: Refill local caches in batches Emil Tsalapatis
2026-10-27 19:50   ` Alexei Starovoitov [this message]
2026-10-27 20:57     ` Emil Tsalapatis
2026-10-28  4:51       ` Alexei Starovoitov
2026-10-23  0:20 ` [PATCH bpf-next v3 6/7] selftests/bpf: libarena: Add a transfer cache Emil Tsalapatis
2026-10-27 19:52   ` Alexei Starovoitov
2026-10-27 20:51     ` Emil Tsalapatis
2026-10-23  0:20 ` [PATCH bpf-next v3 7/7] selftests/bpf: libarena: Cover buddy cache fast paths 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=DMFVROPTON36.3LX4QMXFDA91K@gmail.com \
    --to=alexei.starovoitov@gmail.com \
    --cc=andrii@kernel.org \
    --cc=bpf@vger.kernel.org \
    --cc=daniel@iogearbox.net \
    --cc=eddyz87@gmail.com \
    --cc=emil@etsalapatis.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.