linux/tools/testing/selftests/bpf/libarena
Changwoo Min 9d19ca5d0e
selftests/bpf: Remove duplicate copies of the arena spinlock qnodes
bpf_arena_spin_lock.h defines its 64KB qnodes array in the header, so
every translation unit including it emits a copy. __weak makes them all
resolve to one instance, but bpftool gen object merges only the symbols
and concatenates each input's .addr_space.1 bytes, leaving the surplus
copies unreferenced in the linked object.

libarena links ten such units, so nine copies were dead weight (bytes):

  object                             before       after
  -----------------------------------------------------
  .addr_space.1 in libarena.bpf.o    676200       86376
  libarena.skel.h                   2100123      892371
  libarena_asan.skel.h              2641124     1466477

Declare qnodes in the header and let each program define it once:
libarena in src/common.bpf.c, and the arena_spin_lock test beside the
lock it guards.

Tested with test_progs -t arena_spin_lock and -t libarena.

Signed-off-by: Changwoo Min <changwoo@igalia.com>
Reviewed-by: Emil Tsalapatis <emil@etsalapatis.com>
Link: https://lore.kernel.org/bpf/20260817160249.655916-1-changwoo@igalia.com
Signed-off-by: Kumar Kartikeya Dwivedi <memxor@gmail.com>
2026-08-17 19:31:12 +02:00
..
include selftests/bpf: Remove duplicate copies of the arena spinlock qnodes 2026-08-17 19:31:12 +02:00
selftests selftests/bpf: Rename libarena struct bitmap to struct arena_bitmap 2026-07-08 05:15:34 +02:00
src selftests/bpf: Remove duplicate copies of the arena spinlock qnodes 2026-08-17 19:31:12 +02:00
Makefile selftests/bpf: Rename libarena malloc/free methods 2026-04-28 07:40:21 -07:00