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

From: Kumar Kartikeya Dwivedi

Date: Mon Aug 17 2026 - 14:05:37 EST


On Mon Aug 17, 2026 at 7:14 PM CEST, Emil Tsalapatis wrote:
> On Mon, Aug 17, 2026 at 9:02 AM Changwoo Min <changwoo@xxxxxxxxxx> wrote:
>>
>> >
>> Hi Daniel,
>>
>> On 8/17/26 6:05 PM, Daniel Borkmann wrote:
>> > 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>
>
> Hi Changwoo,
>
> Sorry for the late reply, for the next version feel free to add:
>
> Reviewed-by: Emil Tsalapatis <emil@xxxxxxxxxxxxxxx>
>

Added the tag to v2 and applied, thanks.

>> > This doesn't apply cleanly, could you respin against latest bpf-next?
>>
>> Sure. I will send the v2 rebased on the HEAD of the the bpf-next tree soon.
>>
>> Regards.
>> Changwoo Min
>>
>> >
>> > Thanks,
>> > Daniel
>> >
>>
>>