From: Pekka Enberg Date: Mon, 14 Apr 2008 15:50:44 +0000 (+0300) Subject: slub: Initialize per-cpu stats X-Git-Tag: v2.6.26-rc1~1159^2~5 X-Git-Url: http://www.pilppa.org/gitweb/gitweb.cgi?a=commitdiff_plain;h=62f75532b583c03840f31e40386ce2df73be9ca0;p=linux-2.6-omap-h63xx.git slub: Initialize per-cpu stats As spotted by kmemcheck, we need to initialize the per-CPU ->stat array before using it. [kmem_cache_cpu structures are usually allocated from arrays defined via DEFINE_PER_CPU that are zeroed so we have not noticed this so far --cl]. Reported-by: Vegard Nossum Signed-off-by: Christoph Lameter Signed-off-by: Pekka Enberg --- diff --git a/mm/slub.c b/mm/slub.c index acc975fcc8c..15a7a0d45d7 100644 --- a/mm/slub.c +++ b/mm/slub.c @@ -1886,6 +1886,9 @@ static void init_kmem_cache_cpu(struct kmem_cache *s, c->node = 0; c->offset = s->offset / sizeof(void *); c->objsize = s->objsize; +#ifdef CONFIG_SLUB_STATS + memset(c->stat, 0, NR_SLUB_STAT_ITEMS * sizeof(unsigned)); +#endif } static void init_kmem_cache_node(struct kmem_cache_node *n)