Skip to content

Commit 67b6c90

Browse files
hansendcpenberg
authored andcommitted
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 <peterz@infradead.org> Cc: Russell King <linux@arm.linux.org.uk> Acked-by: David Rientjes <rientjes@google.com> Signed-off-by: Dave Hansen <dave.hansen@linux.intel.com> Signed-off-by: Pekka Enberg <penberg@kernel.org>
1 parent 433a91f commit 67b6c90

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

mm/slub.c

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2890,7 +2890,13 @@ static void early_kmem_cache_node_alloc(int node)
28902890
init_kmem_cache_node(n);
28912891
inc_slabs_node(kmem_cache_node, node, page->objects);
28922892

2893+
/*
2894+
* the lock is for lockdep's sake, not for any actual
2895+
* race protection
2896+
*/
2897+
spin_lock(&n->list_lock);
28932898
add_partial(n, page, DEACTIVATE_TO_HEAD);
2899+
spin_unlock(&n->list_lock);
28942900
}
28952901

28962902
static void free_kmem_cache_nodes(struct kmem_cache *s)

0 commit comments

Comments
 (0)