From 6d920febf5a78394fb5da2ffa4b0cf6636b707d8 Mon Sep 17 00:00:00 2001 From: Dave Hansen Date: Fri, 24 Jan 2014 07:20:23 -0800 Subject: mm: slub: work around unneeded lockdep warning The slub code does some setup during early boot in early_kmem_cache_node_alloc() with some local data. There is no possible way that another CPU can see this data, so the slub code doesn't unnecessarily lock it. However, some new lockdep asserts check to make sure that add_partial() _always_ has the list_lock held. Just add the locking, even though it is technically unnecessary. Cc: Peter Zijlstra Cc: Russell King Acked-by: David Rientjes Signed-off-by: Dave Hansen Signed-off-by: Pekka Enberg Signed-off-by: W4TCH0UT Signed-off-by: Anik1199 Conflicts: mm/slub.c --- mm/slub.c | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/mm/slub.c b/mm/slub.c index 82a3fffe6..06fb1a9d5 100644 --- a/mm/slub.c +++ b/mm/slub.c @@ -1,3 +1,4 @@ + /* * SLUB: A slab allocator that limits cache line use instead of queuing * objects in per cpu and per node lists. @@ -3077,10 +3078,12 @@ static void early_kmem_cache_node_alloc(int node) inc_slabs_node(kmem_cache_node, node, page->objects); /* - * No locks need to be taken here as it has just been - * initialized and there is no concurrent access. + * the lock is for lockdep's sake, not for any actual + * race protection */ - __add_partial(n, page, DEACTIVATE_TO_HEAD); + spin_lock(&n->list_lock); + add_partial(n, page, DEACTIVATE_TO_HEAD); + spin_unlock(&n->list_lock); } static void free_kmem_cache_nodes(struct kmem_cache *s) -- cgit v1.2.3