Re: [PATCH bpf-next 1/3] bpf: Add memory usage for arena

From: bot+bpf-ci

Date: Thu Jul 16 2026 - 12:48:21 EST


> bpf: Add memory usage for arena
>
> arena is the only map type whose map_mem_usage() still returns 0, so
> "bpftool map show" and fdinfo always showed 0 memlock for an arena no
> matter how many pages it had.
>
> Count the pages that are actually mapped into the arena: bump a counter in
> apply_range_set_cb() when a page goes in and drop it in
> apply_range_clear_cb() when a page goes out, both under the arena spinlock.
> map_mem_usage() then just returns nr_pages << PAGE_SHIFT.
>
> Only real data pages are counted, not the scratch page.
>
> Signed-off-by: Jiayuan Chen <jiayuan.chen@xxxxxxxxx>

This looks like a fix for a user-visible bug: arena's map_mem_usage()
always returned 0, so bpftool map show and fdinfo reported 0 memlock
regardless of how many pages the arena had. The returns-0 stub was added
together with kernel/bpf/arena.c. Should this include:

Fixes: 317460317a02 ("bpf: Introduce bpf_arena.")


---
AI reviewed your patch. Please fix the bug or email reply why it's not a bug.
See: https://github.com/kernel-patches/vmtest/blob/master/ci/claude/README.md

CI run summary: https://github.com/kernel-patches/bpf/actions/runs/29508297958