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 <[email protected]>
This doesn't apply cleanly, could you respin against latest bpf-next?

Thanks,
Daniel

Reply via email to