aboutsummaryrefslogtreecommitdiffstats
path: root/mm/slob.c
diff options
context:
space:
mode:
authorChristoph Lameter <cl@linux.com>2012-09-04 19:18:33 -0400
committerPekka Enberg <penberg@kernel.org>2012-09-05 05:00:35 -0400
commit945cf2b6199be70ff03102b9e642c3bb05d01de9 (patch)
treeb0deef56b1d79af1054f0cf1bd91c6fb00ce31a5 /mm/slob.c
parent7c9adf5a5471647f392169ef19d3e81dcfa76045 (diff)
mm/sl[aou]b: Extract a common function for kmem_cache_destroy
kmem_cache_destroy does basically the same in all allocators. Extract common code which is easy since we already have common mutex handling. Reviewed-by: Glauber Costa <glommer@parallels.com> Signed-off-by: Christoph Lameter <cl@linux.com> Signed-off-by: Pekka Enberg <penberg@kernel.org>
Diffstat (limited to 'mm/slob.c')
-rw-r--r--mm/slob.c15
1 files changed, 7 insertions, 8 deletions
diff --git a/mm/slob.c b/mm/slob.c
index 5225d28f2694..289be4f4681a 100644
--- a/mm/slob.c
+++ b/mm/slob.c
@@ -538,18 +538,11 @@ struct kmem_cache *__kmem_cache_create(const char *name, size_t size,
538 return c; 538 return c;
539} 539}
540 540
541void kmem_cache_destroy(struct kmem_cache *c) 541void __kmem_cache_destroy(struct kmem_cache *c)
542{ 542{
543 mutex_lock(&slab_mutex);
544 list_del(&c->list);
545 mutex_unlock(&slab_mutex);
546
547 kmemleak_free(c); 543 kmemleak_free(c);
548 if (c->flags & SLAB_DESTROY_BY_RCU)
549 rcu_barrier();
550 slob_free(c, sizeof(struct kmem_cache)); 544 slob_free(c, sizeof(struct kmem_cache));
551} 545}
552EXPORT_SYMBOL(kmem_cache_destroy);
553 546
554void *kmem_cache_alloc_node(struct kmem_cache *c, gfp_t flags, int node) 547void *kmem_cache_alloc_node(struct kmem_cache *c, gfp_t flags, int node)
555{ 548{
@@ -617,6 +610,12 @@ unsigned int kmem_cache_size(struct kmem_cache *c)
617} 610}
618EXPORT_SYMBOL(kmem_cache_size); 611EXPORT_SYMBOL(kmem_cache_size);
619 612
613int __kmem_cache_shutdown(struct kmem_cache *c)
614{
615 /* No way to check for remaining objects */
616 return 0;
617}
618
620int kmem_cache_shrink(struct kmem_cache *d) 619int kmem_cache_shrink(struct kmem_cache *d)
621{ 620{
622 return 0; 621 return 0;