Re: [RFC, PATCH] set SLAB_HWCACHE_ALIGN for kmalloc caches

From: Manfred Spraul
Date: Sat May 29 2004 - 02:01:36 EST


Andrew Morton wrote:

Manfred Spraul <manfred@xxxxxxxxxxxxxxxx> wrote:


I think the kmalloc caches should remain cache line aligned



I'm not so sure. size-64 is used a lot for out-of-line dentry names.
Taking these up to 128 bytes or even more will consume considerable
memory in some situations.


No, it won't:

/* Default alignment: as specified by the arch code.
* Except if an object is really small, then squeeze multiple
* into one cacheline.
*/
align = cache_line_size();
while (size <= align/2)
align /= 2;

SLAB_HWCACHE_ALIGN is still just a hint, for small objects it's converted to alignment to a power of two boundary.

--
Manfred

-
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/