slab-alignment-rework.patch in -mc

From: Andrea Arcangeli
Date: Mon Apr 19 2004 - 11:26:45 EST


/mirror/kernel/people/akpm/patches/2.6/2.6.5/2.6.5-mc4/broken-out/slab-alignment-rework.patch

I don't think this is right:

> - if (flags & SLAB_HWCACHE_ALIGN) {
> - /* Need to adjust size so that objs are cache aligned. */
> - /* Small obj size, can get at least two per cache line. */
> + if (!align) {
> + /* Default alignment: compile time specified l1 cache size.
> + * Except if an object is really small, then squeeze multiple
> + * into one cacheline.
> + */
> + align = cache_line_size();
> while (size <= align/2)
> align /= 2;
> - size = (size+align-1)&(~(align-1));
> }
> + size = ALIGN(size, align);
>

I want anon-vma to really use only 12 bytes, period. No best-guess must
be made automatically by the slab code, rounding it to 16 bytes.

this is not just for anon-vma though. For this specific case it's
absolteuly useless to throw 4 more bytes of ram at every anon-vma, it's
not hw aligned anyways so there will be false sharing anyways, so at the
very least we must try to save ram since we cannot scale the cache anyways.
Other cases for small objects are similar.

Overall I think it's definitely wrong to remove the hw alignment request
from the caller, the hw alignment must be used only where worthwhile.
for vmas and anon-vmas the hw alignment definitely isn't worthwhile and
we must not waste ram like the above patch does.

The other changes like using cache_line_size() is an _obvious_
improvement of course, I'm not commenting that part, but I'd ask to
please rewrite that patch removing the removal of the hw-alignment
parameter dictated by the kmem_cache_create caller.
-
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/