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

From: H. Peter Anvin
Date: Wed Oct 20 2010 - 17:34:13 EST


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
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/