/mirror/kernel/people/akpm/patches/2.6/2.6.5/2.6.5-mc4/broken-out/slab-alignment-rework.patchThen pass "4" as the align parameter to kmem_cache_create. That's the main point of the patch: it's now possible to explicitely specify the requested alignment. 32 for the 3rd level page tables, the optimal number for the pte_chains, etc.
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 mustIf you pass 0 as align to kmem_cache_create, then it's rounded to L2 size. It's questionable if that's really the best thing - on uniprocessor, 16-byte might result is better performance - there is no risk of false sharing.
be made automatically by the slab code, rounding it to 16 bytes.