From: Jiayuan Chen <jiayuan.chen@linux.dev>
To: bpf@vger.kernel.org
Cc: Jiayuan Chen <jiayuan.chen@linux.dev>,
Alexei Starovoitov <ast@kernel.org>,
Daniel Borkmann <daniel@iogearbox.net>,
Andrii Nakryiko <andrii@kernel.org>,
Eduard Zingerman <eddyz87@gmail.com>,
Kumar Kartikeya Dwivedi <memxor@gmail.com>,
Martin KaFai Lau <martin.lau@linux.dev>,
Song Liu <song@kernel.org>,
Yonghong Song <yonghong.song@linux.dev>,
Jiri Olsa <jolsa@kernel.org>,
Emil Tsalapatis <emil@etsalapatis.com>,
Shuah Khan <shuah@kernel.org>, Woojin Ji <random6.xyz@gmail.com>,
Puranjay Mohan <puranjay@kernel.org>,
Saket Kumar Bhaskar <skb99@linux.ibm.com>,
Ihor Solodrai <ihor.solodrai@linux.dev>,
linux-kernel@vger.kernel.org, linux-kselftest@vger.kernel.org
Subject: [PATCH bpf-next v2 0/4] bpf: Add memory usage for arena and selftest
Date: Fri, 17 Jul 2026 19:37:00 +0800 [thread overview]
Message-ID: <20260717114117.350851-1-jiayuan.chen@linux.dev> (raw)
arena is the only map type whose map_mem_usage() still returns 0, so
bpftool and fdinfo always show 0 memlock for it no matter how many pages
it holds. This series adds the accounting, runs the arena selftests
serially so they don't OOM a small CI VM, and adds a test for it.
v1 -> v2:
- split the scratch_page -> arena refactor into a prep patch (no
functional change)
- use WRITE_ONCE() for nr_pages to pair with the lockless reader
- reword the "run serially" commit message
- selftest: alloc prog returns 0 so the failure check is reached
v1: https://lore.kernel.org/bpf/20260716142746.8794-1-jiayuan.chen@linux.dev/
Jiayuan Chen (4):
bpf: Pass arena instead of scratch_page to the pte callbacks
bpf: Add memory usage for arena
selftests/bpf: Run arena tests serially
selftests/bpf: Add tests for memory usage for arena
kernel/bpf/arena.c | 27 ++--
.../selftests/bpf/prog_tests/arena_atomics.c | 2 +-
.../bpf/prog_tests/arena_direct_value.c | 2 +-
.../selftests/bpf/prog_tests/arena_htab.c | 2 +-
.../selftests/bpf/prog_tests/arena_list.c | 2 +-
.../bpf/prog_tests/arena_mem_usage.c | 122 ++++++++++++++++++
.../bpf/prog_tests/arena_spin_lock.c | 2 +-
.../bpf/prog_tests/arena_strsearch.c | 2 +-
.../selftests/bpf/prog_tests/libarena.c | 2 +-
.../selftests/bpf/prog_tests/libarena_asan.c | 2 +-
.../selftests/bpf/progs/arena_mem_usage.c | 40 ++++++
11 files changed, 186 insertions(+), 19 deletions(-)
create mode 100644 tools/testing/selftests/bpf/prog_tests/arena_mem_usage.c
create mode 100644 tools/testing/selftests/bpf/progs/arena_mem_usage.c
--
2.43.0
next reply other threads:[~2026-07-17 11:41 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-07-17 11:37 Jiayuan Chen [this message]
2026-07-17 11:37 ` [PATCH bpf-next v2 1/4] bpf: Pass arena instead of scratch_page to the pte callbacks Jiayuan Chen
2026-07-17 11:37 ` [PATCH bpf-next v2 2/4] bpf: Add memory usage for arena Jiayuan Chen
2026-07-17 11:37 ` [PATCH bpf-next v2 3/4] selftests/bpf: Run arena tests serially Jiayuan Chen
2026-07-17 11:37 ` [PATCH bpf-next v2 4/4] selftests/bpf: Add tests for memory usage for arena Jiayuan Chen
2026-07-17 11:53 ` sashiko-bot
2026-07-17 13:18 ` Jiayuan Chen
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=20260717114117.350851-1-jiayuan.chen@linux.dev \
--to=jiayuan.chen@linux.dev \
--cc=andrii@kernel.org \
--cc=ast@kernel.org \
--cc=bpf@vger.kernel.org \
--cc=daniel@iogearbox.net \
--cc=eddyz87@gmail.com \
--cc=emil@etsalapatis.com \
--cc=ihor.solodrai@linux.dev \
--cc=jolsa@kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-kselftest@vger.kernel.org \
--cc=martin.lau@linux.dev \
--cc=memxor@gmail.com \
--cc=puranjay@kernel.org \
--cc=random6.xyz@gmail.com \
--cc=shuah@kernel.org \
--cc=skb99@linux.ibm.com \
--cc=song@kernel.org \
--cc=yonghong.song@linux.dev \
/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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox