Re: Q: explicit alignment control for the slab allocator

Mark Hemment (markhe@veritas.com)
Thu, 1 Mar 2001 18:09:07 +0000 (GMT)


On Thu, 1 Mar 2001, Manfred Spraul wrote:

> Alan added a CONFIG options for FORCED_DEBUG slab debugging, but there
> is one minor problem with FORCED_DEBUG: FORCED_DEBUG disables
> HW_CACHEALIGN, and several drivers assume that HW_CACHEALIGN implies a
> certain alignment (iirc usb/uhci.c assumes 16-byte alignment)
>
> I've attached a patch that fixes the explicit alignment control in
> kmem_cache_create().
>
> The parameter 'offset' [the minimum offset to be used for cache
> coloring] actually is the guaranteed alignment, except that the
> implementation was broken. I've fixed the implementation and renamed
> 'offset' to 'align'.

As the original author of the slab allocator, I can assure you there is
nothing guaranteed about "offset". Neither is it to do with any minimum.

The original idea behind offset was for objects with a "hot" area
greater than a single L1 cache line. By using offset correctly (and to my
knowledge it has never been used anywhere in the Linux kernel), a SLAB
cache creator (caller of kmem_cache_create()) could ask the SLAB for more
than one colour (space/L1 cache lines) offset between objects.

As no one uses the feature it could well be broken, but is that a reason
to change its meaning?

Mark

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