diff options
Diffstat (limited to 'mm/slab_common.c')
-rw-r--r-- | mm/slab_common.c | 13 |
1 files changed, 11 insertions, 2 deletions
diff --git a/mm/slab_common.c b/mm/slab_common.c index f3cfccf76dda..102cc6fca3d3 100644 --- a/mm/slab_common.c +++ b/mm/slab_common.c | |||
@@ -323,6 +323,12 @@ static int kmem_cache_destroy_memcg_children(struct kmem_cache *s) | |||
323 | } | 323 | } |
324 | #endif /* CONFIG_MEMCG_KMEM */ | 324 | #endif /* CONFIG_MEMCG_KMEM */ |
325 | 325 | ||
326 | void slab_kmem_cache_release(struct kmem_cache *s) | ||
327 | { | ||
328 | kfree(s->name); | ||
329 | kmem_cache_free(kmem_cache, s); | ||
330 | } | ||
331 | |||
326 | void kmem_cache_destroy(struct kmem_cache *s) | 332 | void kmem_cache_destroy(struct kmem_cache *s) |
327 | { | 333 | { |
328 | get_online_cpus(); | 334 | get_online_cpus(); |
@@ -352,8 +358,11 @@ void kmem_cache_destroy(struct kmem_cache *s) | |||
352 | rcu_barrier(); | 358 | rcu_barrier(); |
353 | 359 | ||
354 | memcg_free_cache_params(s); | 360 | memcg_free_cache_params(s); |
355 | kfree(s->name); | 361 | #ifdef SLAB_SUPPORTS_SYSFS |
356 | kmem_cache_free(kmem_cache, s); | 362 | sysfs_slab_remove(s); |
363 | #else | ||
364 | slab_kmem_cache_release(s); | ||
365 | #endif | ||
357 | goto out_put_cpus; | 366 | goto out_put_cpus; |
358 | 367 | ||
359 | out_unlock: | 368 | out_unlock: |