From baf0ed19d60eb061766a7e096397e6a2b3ac9be5 Mon Sep 17 00:00:00 2001 From: Christoph Lameter Date: Thu, 26 Jun 2014 10:42:26 +1000 Subject: [PATCH] slab-use-get_node-and-kmem_cache_node-functions-fix On Thu, 12 Jun 2014, Joonsoo Kim wrote: > > @@ -3759,8 +3746,8 @@ fail: > > /* Cache is not active yet. Roll back what we did */ > > node--; > > while (node >= 0) { > > - if (cachep->node[node]) { > > - n = cachep->node[node]; > > + if (get_node(cachep, node)) { > > + n = get_node(cachep, node); > > Could you do this as following? > > n = get_node(cachep, node); > if (n) { > ... > } Sure.... Subject: slab: Fixes to earlier patch Signed-off-by: Christoph Lameter Cc: Christoph Lameter Cc: Pekka Enberg Cc: David Rientjes Cc: Joonsoo Kim Signed-off-by: Andrew Morton --- mm/slab.c | 15 +++++++-------- 1 file changed, 7 insertions(+), 8 deletions(-) diff --git a/mm/slab.c b/mm/slab.c index 7455be9b99ae..862e8ee642d6 100644 --- a/mm/slab.c +++ b/mm/slab.c @@ -561,8 +561,8 @@ static inline void on_slab_lock_classes(struct kmem_cache *cachep) struct kmem_cache_node *n; VM_BUG_ON(OFF_SLAB(cachep)); - for_each_kmem_cache_node(cachep, node, h) - on_slab_lock_classes_node(cachep, h); + for_each_kmem_cache_node(cachep, node, n) + on_slab_lock_classes_node(cachep, n); } static inline void __init init_lock_keys(void) @@ -586,7 +586,7 @@ static inline void on_slab_lock_classes(struct kmem_cache *cachep) } static inline void on_slab_lock_classes_node(struct kmem_cache *cachep, - int node, struct kmem_cache_node *n) + struct kmem_cache_node *n) { } @@ -823,7 +823,7 @@ static inline bool is_slab_pfmemalloc(struct page *page) static void recheck_pfmemalloc_active(struct kmem_cache *cachep, struct array_cache *ac) { - struct kmem_cache_node *n = get_node(cachep,numa_mem_id()); + struct kmem_cache_node *n = get_node(cachep, numa_mem_id()); struct page *page; unsigned long flags; @@ -1308,7 +1308,7 @@ static int cpuup_prepare(long cpu) slab_set_debugobj_lock_classes_node(cachep, node); else if (!OFF_SLAB(cachep) && !(cachep->flags & SLAB_DESTROY_BY_RCU)) - on_slab_lock_classes_node(cachep, node, n); + on_slab_lock_classes_node(cachep, n); } init_node_lock_keys(node); @@ -3807,9 +3807,8 @@ fail: /* Cache is not active yet. Roll back what we did */ node--; while (node >= 0) { - if (get_node(cachep, node)) { - n = get_node(cachep, node); - + n = get_node(cachep, node); + if (n) { kfree(n->shared); free_alien_cache(n->alien); kfree(n); -- 2.39.5