diff options
Diffstat (limited to 'mm/slab.c')
-rw-r--r-- | mm/slab.c | 26 |
1 files changed, 2 insertions, 24 deletions
@@ -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 */ | 2483 | int __kmem_cache_shrink(struct kmem_cache *cachep) |
2484 | static 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 | */ | ||
2512 | int 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 | } | ||
2524 | EXPORT_SYMBOL(kmem_cache_shrink); | ||
2525 | |||
2526 | int __kmem_cache_shutdown(struct kmem_cache *cachep) | 2504 | int __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; |