Skip to content

Commit ea37df5

Browse files
ramosian-glidertorvalds
authored andcommitted
slub: tidy up initialization ordering
- 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>
1 parent 964f14a commit ea37df5

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

mm/slub.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3358,8 +3358,8 @@ static void free_kmem_cache_nodes(struct kmem_cache *s)
33583358
struct kmem_cache_node *n;
33593359

33603360
for_each_kmem_cache_node(s, node, n) {
3361-
kmem_cache_free(kmem_cache_node, n);
33623361
s->node[node] = NULL;
3362+
kmem_cache_free(kmem_cache_node, n);
33633363
}
33643364
}
33653365

@@ -3389,8 +3389,8 @@ static int init_kmem_cache_nodes(struct kmem_cache *s)
33893389
return 0;
33903390
}
33913391

3392-
s->node[node] = n;
33933392
init_kmem_cache_node(n);
3393+
s->node[node] = n;
33943394
}
33953395
return 1;
33963396
}

0 commit comments

Comments
 (0)