diff options
Diffstat (limited to 'mm/slab_common.c')
-rw-r--r-- | mm/slab_common.c | 15 |
1 files changed, 13 insertions, 2 deletions
diff --git a/mm/slab_common.c b/mm/slab_common.c index 0873bcc61c7a..1a1cc89acaa3 100644 --- a/mm/slab_common.c +++ b/mm/slab_common.c | |||
@@ -549,10 +549,13 @@ void memcg_deactivate_kmem_caches(struct mem_cgroup *memcg) | |||
549 | { | 549 | { |
550 | int idx; | 550 | int idx; |
551 | struct memcg_cache_array *arr; | 551 | struct memcg_cache_array *arr; |
552 | struct kmem_cache *s; | 552 | struct kmem_cache *s, *c; |
553 | 553 | ||
554 | idx = memcg_cache_id(memcg); | 554 | idx = memcg_cache_id(memcg); |
555 | 555 | ||
556 | get_online_cpus(); | ||
557 | get_online_mems(); | ||
558 | |||
556 | mutex_lock(&slab_mutex); | 559 | mutex_lock(&slab_mutex); |
557 | list_for_each_entry(s, &slab_caches, list) { | 560 | list_for_each_entry(s, &slab_caches, list) { |
558 | if (!is_root_cache(s)) | 561 | if (!is_root_cache(s)) |
@@ -560,9 +563,17 @@ void memcg_deactivate_kmem_caches(struct mem_cgroup *memcg) | |||
560 | 563 | ||
561 | arr = rcu_dereference_protected(s->memcg_params.memcg_caches, | 564 | arr = rcu_dereference_protected(s->memcg_params.memcg_caches, |
562 | lockdep_is_held(&slab_mutex)); | 565 | lockdep_is_held(&slab_mutex)); |
566 | c = arr->entries[idx]; | ||
567 | if (!c) | ||
568 | continue; | ||
569 | |||
570 | __kmem_cache_shrink(c, true); | ||
563 | arr->entries[idx] = NULL; | 571 | arr->entries[idx] = NULL; |
564 | } | 572 | } |
565 | mutex_unlock(&slab_mutex); | 573 | mutex_unlock(&slab_mutex); |
574 | |||
575 | put_online_mems(); | ||
576 | put_online_cpus(); | ||
566 | } | 577 | } |
567 | 578 | ||
568 | void memcg_destroy_kmem_caches(struct mem_cgroup *memcg) | 579 | void memcg_destroy_kmem_caches(struct mem_cgroup *memcg) |
@@ -649,7 +660,7 @@ int kmem_cache_shrink(struct kmem_cache *cachep) | |||
649 | 660 | ||
650 | get_online_cpus(); | 661 | get_online_cpus(); |
651 | get_online_mems(); | 662 | get_online_mems(); |
652 | ret = __kmem_cache_shrink(cachep); | 663 | ret = __kmem_cache_shrink(cachep, false); |
653 | put_online_mems(); | 664 | put_online_mems(); |
654 | put_online_cpus(); | 665 | put_online_cpus(); |
655 | return ret; | 666 | return ret; |