From: Christoph Lameter Date: Mon, 10 Jan 2011 16:15:15 +0000 (-0600) Subject: slub: Avoid use of slub_lock in show_slab_objects() X-Git-Tag: upstream/snapshot3+hdmi~11701^2~2^2 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=04d94879c8a4973b5499dc26b9d38acee8928791;p=platform%2Fadaptation%2Frenesas_rcar%2Frenesas_kernel.git slub: Avoid use of slub_lock in show_slab_objects() The purpose of the locking is to prevent removal and additions of nodes when statistics are gathered for a slab cache. So we need to avoid racing with memory hotplug functionality. It is enough to take the memory hotplug locks there instead of the slub_lock. online_pages() currently does not acquire the memory_hotplug lock. Another patch will be submitted by the memory hotplug authors to take the memory hotplug lock and describe the uses of the memory hotplug lock to protect against adding and removal of nodes from non hotplug data structures. Cc: # 2.6.37 Reported-and-tested-by: Bart Van Assche Acked-by: David Rientjes Signed-off-by: Christoph Lameter Signed-off-by: Pekka Enberg --- diff --git a/mm/slub.c b/mm/slub.c index bec0e35..96e6907 100644 --- a/mm/slub.c +++ b/mm/slub.c @@ -3821,7 +3821,7 @@ static ssize_t show_slab_objects(struct kmem_cache *s, } } - down_read(&slub_lock); + lock_memory_hotplug(); #ifdef CONFIG_SLUB_DEBUG if (flags & SO_ALL) { for_each_node_state(node, N_NORMAL_MEMORY) { @@ -3862,7 +3862,7 @@ static ssize_t show_slab_objects(struct kmem_cache *s, x += sprintf(buf + x, " N%d=%lu", node, nodes[node]); #endif - up_read(&slub_lock); + unlock_memory_hotplug(); kfree(nodes); return x + sprintf(buf + x, "\n"); }