Skip to contentSkip to conversation

mm: slub: work around unneeded lockdep warning

PATCH In review Dave Hansen 2 participants 2 messages Jan 24, 2014 – Jan 26, 2014

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 mm: slub: work around unneeded lockdep warning

I think this is a next-only thing. Pekka, can you pick this up, please?

--

From: Dave Hansen <[email protected]>

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 <[email protected]>
Cc Pekka Enberg <[email protected]>
Cc Russell King <[email protected]>

---

 b/mm/slub.c |    6 ++++++
 1 file changed, 6 insertions(+)
mm/slub.c renamed from mm/slub.c~slub-lockdep-workaround +6 -0
diff -puN mm/slub.c~slub-lockdep-workaround mm/slub.c
@@ -2890,7 +2890,13 @@ static void early_kmem_cache_node_alloc(
 	init_kmem_cache_node(n);
 	inc_slabs_node(kmem_cache_node, node, page->objects);
 
+	/*
+	 * the lock is for lockdep's sake, not for any actual
+	 * race protection
+	 */
+	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)

_

reviewer Acked-by on v1 1/1
#1 lore raw
Quoted 9 lines · Dave Hansen

From: Dave Hansen <[email protected]>

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.

Quoted 6 lines

Just add the locking, even though it is technically unnecessary.

Cc Peter Zijlstra <[email protected]>
Cc Pekka Enberg <[email protected]>
Cc Russell King <[email protected]>

--
To unsubscribe, send a message with 'unsubscribe linux-mm' in the body to [email protected]. For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"[email protected]"> [email protected] </a>