aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPekka Enberg <penberg@cs.helsinki.fi>2008-04-14 11:50:44 -0400
committerPekka Enberg <penberg@cs.helsinki.fi>2008-04-14 11:50:44 -0400
commit62f75532b583c03840f31e40386ce2df73be9ca0 (patch)
tree22f532faf421878b593b467a9d8bf29d6769c30f
parent120dd64cacd4fb796bca0acba3665553f1d9ecaa (diff)
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 <vegard.nossum@gmail.com> Signed-off-by: Christoph Lameter <clameter@sgi.com> Signed-off-by: Pekka Enberg <penberg@cs.helsinki.fi>
-rw-r--r--mm/slub.c3
1 files changed, 3 insertions, 0 deletions
diff --git a/mm/slub.c b/mm/slub.c
index acc975fcc8cc..15a7a0d45d71 100644
--- a/mm/slub.c
+++ b/mm/slub.c
@@ -1886,6 +1886,9 @@ static void init_kmem_cache_cpu(struct kmem_cache *s,
1886 c->node = 0; 1886 c->node = 0;
1887 c->offset = s->offset / sizeof(void *); 1887 c->offset = s->offset / sizeof(void *);
1888 c->objsize = s->objsize; 1888 c->objsize = s->objsize;
1889#ifdef CONFIG_SLUB_STATS
1890 memset(c->stat, 0, NR_SLUB_STAT_ITEMS * sizeof(unsigned));
1891#endif
1889} 1892}
1890 1893
1891static void init_kmem_cache_node(struct kmem_cache_node *n) 1894static void init_kmem_cache_node(struct kmem_cache_node *n)