Re: [rfc][patch 3/3] use SLAB_ALIGN_SMP

Eric Dumazet
2008-03-03T14:16:07Z

Pekka Enberg a écrit :
> Hi,
>
> On Mon, Mar 3, 2008 at 3:46 PM, Nick Piggin <npiggin@suse.de> wrote:
>
>> > Maybe we need to use three flags to separate the meanings ?
>> >
>> > SLAB_HINT_SMP_ALIGN
>> > SLAB_HINT_HWCACHE_ALIGN
>> > SLAB_HWCACHE_ALIGN /* strong requirement that two objects dont share a
>> > cache line */
>>
>> Possibly, but I'm beginning to prefer that strong requirements should
>> request the explicit alignment (they can even use cache_line_size() after
>> Pekka's patch to make it generic). I don't like how the name implies
>> that you get a guarantee, however I guess in practice people are using it
>> more as a hint (or because they vaguely hope it makes their code run
>> faster :))
>>
>
> At least historically SLAB_HWCACHE_ALIGN has been just a hint,
> although slab tries very hard to satisfy it (see the comments in
> mm/slab.c). Why do we need stronger guarantees than that, btw?
>
>
This reminds me a previous attempt of removing SLAB_HWCACHE_ALIGN

http://kernel.org/pub/linux/kernel/people/christoph/patch-archive/2007/2.6.21-rc6/remove_hwcache_align

At that time Christoph didnt took into account the CONFIG_SMP thing
(false sharing avoidance), but also that L1_CACHE_SIZE is a compile
constant, that can differs with cache_line_size()