linux/tools/testing/selftests/bpf/libarena/include
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
..
libarena selftests/bpf: Silence maybe-uninitialized compiler warning in libarena 2026-07-20 21:00:57 +02:00
bpf_arena_common.h selftests/bpf: Remove __arg_arena from the codebase 2026-06-01 18:42:33 -07:00
bpf_arena_spin_lock.h selftests/bpf: Remove duplicate copies of the arena spinlock qnodes 2026-08-17 19:31:12 +02:00
bpf_atomic.h libarena: Use compiler load-acquire/store-release in bpf_atomic.h 2026-07-22 18:21:32 +02:00
bpf_may_goto.h