aboutsummaryrefslogtreecommitdiffstats
path: root/mm/slab_common.c
diff options
context:
space:
mode:
Diffstat (limited to 'mm/slab_common.c')
-rw-r--r--mm/slab_common.c25
1 files changed, 25 insertions, 0 deletions
diff --git a/mm/slab_common.c b/mm/slab_common.c
index 5190a7cd02bd..a1c4f0b5aaed 100644
--- a/mm/slab_common.c
+++ b/mm/slab_common.c
@@ -140,6 +140,31 @@ out_locked:
140} 140}
141EXPORT_SYMBOL(kmem_cache_create); 141EXPORT_SYMBOL(kmem_cache_create);
142 142
143void kmem_cache_destroy(struct kmem_cache *s)
144{
145 get_online_cpus();
146 mutex_lock(&slab_mutex);
147 s->refcount--;
148 if (!s->refcount) {
149 list_del(&s->list);
150
151 if (!__kmem_cache_shutdown(s)) {
152 if (s->flags & SLAB_DESTROY_BY_RCU)
153 rcu_barrier();
154
155 __kmem_cache_destroy(s);
156 } else {
157 list_add(&s->list, &slab_caches);
158 printk(KERN_ERR "kmem_cache_destroy %s: Slab cache still has objects\n",
159 s->name);
160 dump_stack();
161 }
162 }
163 mutex_unlock(&slab_mutex);
164 put_online_cpus();
165}
166EXPORT_SYMBOL(kmem_cache_destroy);
167
143int slab_is_available(void) 168int slab_is_available(void)
144{ 169{
145 return slab_state >= UP; 170 return slab_state >= UP;