From: Christoph Lameter SLUB: Fix slab object counting. We can only use the node value of the per cpu structure for counting if it is positive. A negative value indicates that the slab is not valid. Signed-off-by: Christoph Lameter Tested-by: Alexey Dobriyan Signed-off-by: Andrew Morton --- mm/slub.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff -puN mm/slub.c~slub-avoid-touching-page-struct-when-freeing-to-per-cpu-slab-fix mm/slub.c --- a/mm/slub.c~slub-avoid-touching-page-struct-when-freeing-to-per-cpu-slab-fix +++ a/mm/slub.c @@ -3250,12 +3250,16 @@ static unsigned long slab_objects(struct for_each_possible_cpu(cpu) { struct page *page; + int node; struct kmem_cache_cpu *c = get_cpu_slab(s, cpu); if (!c) continue; page = c->page; + node = c->node; + if (node < 0) + continue; if (page) { if (flags & SO_CPU) { int x = 0; @@ -3265,9 +3269,9 @@ static unsigned long slab_objects(struct else x = 1; total += x; - nodes[c->node] += x; + nodes[node] += x; } - per_cpu[c->node]++; + per_cpu[node]++; } } _