Skip to content

bpf: Add memory usage for arena and selftest

Jiayuan Chen bpf linux-kselftest lkml sashiko-reviews 2 versions – Applied

Status from this message: This series was applied to bpf/bpf-next.git (master)

Get series with b4
b4 am [email protected]

Versions newest first · linked by author and title

  1. v2 Latest4 patches 5 repliesApplied 4/4
  2. v13 patches 3 repliesSuperseded

Changes in v2 from the cover letter

- 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

Patches in v2 All 4 applied

#Subject and filesSizeRepliesApplied
1/4bpf: Pass arena instead of scratch_page to the pte callbackskernel/bpf/arena.c+8 -91 replyApplied
2/4bpf: Add memory usage for arenakernel/bpf/arena.c+8 -21 replyApplied
3/4selftests/bpf: Run arena tests seriallytools/testing/selftests/bpf/prog_tests/arena_atomics.c tools/testing/selftests/bpf/prog_tests/arena_direct_value.c tools/testing/selftests/bpf/prog_tests/arena_htab.c +5 more+8 -81 replyApplied
4/4selftests/bpf: Add tests for memory usage for arenatools/testing/selftests/bpf/prog_tests/arena_mem_usage.c tools/testing/selftests/bpf/progs/arena_mem_usage.c+162 -02 repliesApplied

Reviews trailers per patch

All 4 patches have a Reviewed-by or Acked-by.

PatchEmil Tsalapatis
1/4R-b
2/4R-b
3/4R-b
4/4R-b

Trailers given in replies are filled; those carried in the patches from earlier versions are outlined with dashes.

Read the v2 thread

Cover letter [PATCH bpf-next v2 0/4] bpf: Add memory usage for arena and selftest

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/[email protected]/

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
Signature · 1 line
2.43.0