Re: [PATCH 1/2]percpu: introduce read mostly percpu API

H. Peter Anvin
2010-10-20T21:34:08Z

On 10/19/2010 10:18 PM, Eric Dumazet wrote:
>
> We can see many holes because of 2^5 alignments of
> individual .o .data..percpu sections.
>
> find . -name "*.o"|xargs objdump -h|grep percpu
>
> Linker promotes a section alignment from natural alignment to 2^5 as
> soon as the size reaches 2^5
>
> For example in net/ipv4/route.o, we have a per_cpu structure
> (rt_cache_stat), that is an array of 16 integers. The natural alignement
> should be 4 (alignof(int)), but we get :
>
> # objdump -h net/ipv4/route.o|grep percpu
> 19 .data..percpu 00000040 0000000000000000 0000000000000000 00007a80 2**5
>
> For a section replicated N times, this really is a concern.
>

That wouldn't be the linker, that would be the compiler or assembler
-- I suspect it's the compiler -- and that needs to be fixed.

To reduce linker-induced padding, we may want to use SORT_BY_ALIGNMENT()
in the linker script.

-hpa