Re: [PATCH] selftests/bpf: Remove duplicate copies of the arena spinlock qnodes

From: Daniel Borkmann

Date: Mon Aug 17 2026 - 05:05:43 EST


On 8/3/26 2:18 AM, Changwoo Min wrote:
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@xxxxxxxxxx>
This doesn't apply cleanly, could you respin against latest bpf-next?

Thanks,
Daniel