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

Andrey Ryabinin aryabinin at virtuozzo.com
Tue Jul 31 15:37:37 MSK 2018


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 at virtuozzo.com>
---
 mm/memcontrol.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

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();
-- 
2.16.4



More information about the Devel mailing list