[rh7] mm/memcg: don't swap cgroup's pages during offline

Submitted by Andrey Ryabinin on July 31, 2018, 12:37 p.m.

Details

Message ID 20180731123737.5600-1-aryabinin@virtuozzo.com
State New
Series "mm/memcg: don't swap cgroup's pages during offline"
Headers show

Commit Message

Andrey Ryabinin July 31, 2018, 12:37 p.m.
During rmdir of memory cgroup we might have a lot of anonymous pages
(e.g. KSM merged them a lot). Currently our offline cgroup callback
will try to swap them out to release mem cgroup sooner. But this
can take a while, and we do this under global cgroup mutex.
Also forcefully swapping such pages is just bad as they might
be actively in use. So just reclaim without swapping in offline
callback.

https://jira.sw.ru/browse/PSBM-87281
Signed-off-by: Andrey Ryabinin <aryabinin@virtuozzo.com>
---
 mm/memcontrol.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

Patch hide | download patch | download mbox

diff --git a/mm/memcontrol.c b/mm/memcontrol.c
index 8b979d88045c..2a0f7fc159aa 100644
--- a/mm/memcontrol.c
+++ b/mm/memcontrol.c
@@ -6187,7 +6187,8 @@  static void mem_cgroup_free_all(struct mem_cgroup *memcg)
 	lru_add_drain_all();
 
 	while (nr_retries && page_counter_read(&memcg->memory))
-		if (!try_to_free_mem_cgroup_pages(memcg, -1UL, GFP_KERNEL, 0))
+		if (!try_to_free_mem_cgroup_pages(memcg, -1UL, GFP_KERNEL,
+						MEM_CGROUP_RECLAIM_NOSWAP))
 			nr_retries--;
 
 	lru_add_drain();