Index: linux-2.6.20-mm2/mm/slub.c =================================================================== --- linux-2.6.20-mm2.orig/mm/slub.c 2007-02-21 21:17:27.000000000 -0800 +++ linux-2.6.20-mm2/mm/slub.c 2007-02-21 21:21:53.000000000 -0800 @@ -843,10 +843,10 @@ return order; } -static unsigned long calculate_alignment(struct kmem_cache *s, +static unsigned long calculate_alignment(unsigned long flags, unsigned long align) { - if (s->flags & (SLAB_MUST_HWCACHE_ALIGN|SLAB_HWCACHE_ALIGN)) + if (flags & (SLAB_MUST_HWCACHE_ALIGN|SLAB_HWCACHE_ALIGN)) return L1_CACHE_BYTES; if (align < ARCH_SLAB_MINALIGN) @@ -864,6 +864,9 @@ int cpu; int node; + printk(KERN_ERR "kmem_cache_open(%p, %s, %ld, %ld, %lx, %p, %p)\n", + s, name, size, align, flags, ctor, dtor); + BUG_ON(flags & SLUB_UNIMPLEMENTED); memset(s, 0, sizeof(struct kmem_cache)); for_each_node(node) @@ -903,9 +906,11 @@ */ s->offset = size / sizeof(void *); size += sizeof(void *); + printk("%s: free pointer moved to offset %d size=%ld\n", + s->name, s->offset, size); } - align = calculate_alignment(s, align); + align = calculate_alignment(flags, align); size = ALIGN(size, align); s->size = size; @@ -919,6 +924,7 @@ if (!s->objects) goto error; + printk(KERN_ERR "%s objects=%d order=%d size=%d\n", s->name,s->objects, s->order, s->size); register_slab(s); return 1; @@ -1356,7 +1362,7 @@ #ifdef SLUB_MERGE if (!ctor && !dtor && !(flags & SLUB_NO_MERGE) && align <= ARCH_SLAB_MINALIGN) { - int sz = ALIGN(size, calculate_alignment(s, align)); + int sz = ALIGN(size, calculate_alignment(flags, align)); /* Find the kmalloc slab that would be used for this size */ s = __kmalloc_slab(sz); @@ -1374,8 +1380,10 @@ " into kmalloc array size %d\n", name, (int)size, (int)s->size); return kmem_cache_dup(s); - } - } + } else + printk(KERN_ERR "%s: not merged because of size mismatch size is %d.General cache size is %d\n", name, sz, s->size); + } else + printk(KERN_ERR "%s not merged because of flags,ctor,dtor or align\n", name); #endif s = kmalloc(sizeof(struct kmem_cache), GFP_KERNEL);