aboutsummaryrefslogtreecommitdiffstats
path: root/mm
diff options
context:
space:
mode:
authorVladimir Davydov <vdavydov@parallels.com>2014-06-04 19:10:03 -0400
committerLinus Torvalds <torvalds@linux-foundation.org>2014-06-04 19:54:08 -0400
commit0bd62b1190607e4f1b3c2927ba48672a1cf2a83d (patch)
tree4f19d0dbbf7e82747328de5439b21d8e6013d01f /mm
parent776ed0f0377914d1e65fed903c052e9eef3f4cc3 (diff)
slab: delete cache from list after __kmem_cache_shutdown succeeds
Currently, on kmem_cache_destroy we delete the cache from the slab_list before __kmem_cache_shutdown, inserting it back to the list on failure. Initially, this was done, because we could release the slab_mutex in __kmem_cache_shutdown to delete sysfs slub entry, but since commit 41a212859a4d ("slub: use sysfs'es release mechanism for kmem_cache") we remove sysfs entry later in kmem_cache_destroy after dropping the slab_mutex, so that no implementation of __kmem_cache_shutdown can ever release the lock. Therefore we can simplify the code a bit by moving list_del after __kmem_cache_shutdown. Signed-off-by: Vladimir Davydov <vdavydov@parallels.com> Cc: Christoph Lameter <cl@linux-foundation.org> Cc: Pekka Enberg <penberg@kernel.org> Acked-by: David Rientjes <rientjes@google.com> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'mm')
-rw-r--r--mm/slab_common.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/mm/slab_common.c b/mm/slab_common.c
index 48fafb61f35e..735e01a0db6f 100644
--- a/mm/slab_common.c
+++ b/mm/slab_common.c
@@ -346,15 +346,15 @@ void kmem_cache_destroy(struct kmem_cache *s)
346 if (memcg_cleanup_cache_params(s) != 0) 346 if (memcg_cleanup_cache_params(s) != 0)
347 goto out_unlock; 347 goto out_unlock;
348 348
349 list_del(&s->list);
350 if (__kmem_cache_shutdown(s) != 0) { 349 if (__kmem_cache_shutdown(s) != 0) {
351 list_add(&s->list, &slab_caches);
352 printk(KERN_ERR "kmem_cache_destroy %s: " 350 printk(KERN_ERR "kmem_cache_destroy %s: "
353 "Slab cache still has objects\n", s->name); 351 "Slab cache still has objects\n", s->name);
354 dump_stack(); 352 dump_stack();
355 goto out_unlock; 353 goto out_unlock;
356 } 354 }
357 355
356 list_del(&s->list);
357
358 mutex_unlock(&slab_mutex); 358 mutex_unlock(&slab_mutex);
359 if (s->flags & SLAB_DESTROY_BY_RCU) 359 if (s->flags & SLAB_DESTROY_BY_RCU)
360 rcu_barrier(); 360 rcu_barrier();