Skip to content

Commit

Permalink
mm: slub: work around unneeded lockdep warning
Browse files Browse the repository at this point in the history
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: Russell King <[email protected]>
Acked-by: David Rientjes <[email protected]>
Signed-off-by: Dave Hansen <[email protected]>
Signed-off-by: Pekka Enberg <[email protected]>
  • Loading branch information
hansendc authored and penberg committed Jan 31, 2014
1 parent 433a91f commit 67b6c90
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions mm/slub.c
Original file line number Diff line number Diff line change
Expand Up @@ -2890,7 +2890,13 @@ static void early_kmem_cache_node_alloc(int node)
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)
Expand Down

0 comments on commit 67b6c90

Please sign in to comment.