slub: When allocating a new slab also prep the first object
authorChristoph Lameter <cl@linux.com>
Fri, 22 Jul 2011 14:35:14 +0000 (09:35 -0500)
committerPekka Enberg <penberg@kernel.org>
Mon, 25 Jul 2011 17:58:19 +0000 (20:58 +0300)
We need to branch to the debug code for the first object if we allocate
a new slab otherwise the first object will be marked wrongly as inactive.

Tested-by: Rabin Vincent <rabin@rab.in>
Signed-off-by: Christoph Lameter <cl@linux.com>
Signed-off-by: Pekka Enberg <penberg@kernel.org>
mm/slub.c

index 7836b45ea1fad99cd094ee8a45d5cddf053df54d..e842c19e67fb1b3df59403eebef652cd242f6020 100644 (file)
--- a/mm/slub.c
+++ b/mm/slub.c
@@ -2082,6 +2082,9 @@ new_slab:
                stat(s, ALLOC_SLAB);
                c->node = page_to_nid(page);
                c->page = page;
+
+               if (kmem_cache_debug(s))
+                       goto debug;
                goto load_freelist;
        }
        if (!(gfpflags & __GFP_NOWARN) && printk_ratelimit())