Skip to content

Commit

Permalink
slub: tidy up initialization ordering
Browse files Browse the repository at this point in the history
 - free_kmem_cache_nodes() frees the cache node before nulling out a
   reference to it

 - init_kmem_cache_nodes() publishes the cache node before initializing
   it

Neither of these matter at runtime because the cache nodes cannot be
looked up by any other thread.  But it's neater and more consistent to
reorder these.

Link: http://lkml.kernel.org/r/20170707083408.40410-1-glider@google.com
Signed-off-by: Alexander Potapenko <glider@google.com>
Acked-by: Christoph Lameter <cl@linux.com>
Cc: Pekka Enberg <penberg@kernel.org>
Cc: David Rientjes <rientjes@google.com>
Cc: Joonsoo Kim <iamjoonsoo.kim@lge.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
  • Loading branch information
Alexander Potapenko authored and Linus Torvalds committed Sep 7, 2017
1 parent 964f14a commit ea37df5
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions mm/slub.c
Original file line number Diff line number Diff line change
Expand Up @@ -3358,8 +3358,8 @@ static void free_kmem_cache_nodes(struct kmem_cache *s)
struct kmem_cache_node *n;

for_each_kmem_cache_node(s, node, n) {
kmem_cache_free(kmem_cache_node, n);
s->node[node] = NULL;
kmem_cache_free(kmem_cache_node, n);
}
}

Expand Down Expand Up @@ -3389,8 +3389,8 @@ static int init_kmem_cache_nodes(struct kmem_cache *s)
return 0;
}

s->node[node] = n;
init_kmem_cache_node(n);
s->node[node] = n;
}
return 1;
}
Expand Down

0 comments on commit ea37df5

Please sign in to comment.