aboutsummaryrefslogtreecommitdiffstats
path: root/mm/slab.c
diff options
context:
space:
mode:
Diffstat (limited to 'mm/slab.c')
-rw-r--r--mm/slab.c26
1 files changed, 2 insertions, 24 deletions
diff --git a/mm/slab.c b/mm/slab.c
index 944ac58cfcf8..7067ea7f3927 100644
--- a/mm/slab.c
+++ b/mm/slab.c
@@ -2480,8 +2480,7 @@ out:
2480 return nr_freed; 2480 return nr_freed;
2481} 2481}
2482 2482
2483/* Called with slab_mutex held to protect against cpu hotplug */ 2483int __kmem_cache_shrink(struct kmem_cache *cachep)
2484static int __cache_shrink(struct kmem_cache *cachep)
2485{ 2484{
2486 int ret = 0, i = 0; 2485 int ret = 0, i = 0;
2487 struct kmem_cache_node *n; 2486 struct kmem_cache_node *n;
@@ -2502,32 +2501,11 @@ static int __cache_shrink(struct kmem_cache *cachep)
2502 return (ret ? 1 : 0); 2501 return (ret ? 1 : 0);
2503} 2502}
2504 2503
2505/**
2506 * kmem_cache_shrink - Shrink a cache.
2507 * @cachep: The cache to shrink.
2508 *
2509 * Releases as many slabs as possible for a cache.
2510 * To help debugging, a zero exit status indicates all slabs were released.
2511 */
2512int kmem_cache_shrink(struct kmem_cache *cachep)
2513{
2514 int ret;
2515 BUG_ON(!cachep || in_interrupt());
2516
2517 get_online_cpus();
2518 mutex_lock(&slab_mutex);
2519 ret = __cache_shrink(cachep);
2520 mutex_unlock(&slab_mutex);
2521 put_online_cpus();
2522 return ret;
2523}
2524EXPORT_SYMBOL(kmem_cache_shrink);
2525
2526int __kmem_cache_shutdown(struct kmem_cache *cachep) 2504int __kmem_cache_shutdown(struct kmem_cache *cachep)
2527{ 2505{
2528 int i; 2506 int i;
2529 struct kmem_cache_node *n; 2507 struct kmem_cache_node *n;
2530 int rc = __cache_shrink(cachep); 2508 int rc = __kmem_cache_shrink(cachep);
2531 2509
2532 if (rc) 2510 if (rc)
2533 return rc; 2511 return rc;