[Devel] [PATCH RHEL7 COMMIT] memcg: do not loop in mem_cgroup_reclaim if killed

Vladimir Davydov vdavydov at virtuozzo.com
Tue Sep 8 08:31:00 PDT 2015


The commit is pushed to "branch-rh7-3.10.0-229.7.2-ovz" and will appear at https://src.openvz.org/scm/ovz/vzkernel.git
after rh7-3.10.0-229.7.2.vz7.6.8
------>
commit 32822775eafa10b34db19f96f5fb8ee833263372
Author: Vladimir Davydov <vdavydov at parallels.com>
Date:   Tue Sep 8 19:31:00 2015 +0400

    memcg: do not loop in mem_cgroup_reclaim if killed
    
    If try_to_free_mem_cgroup_pages is called by a killed process, it will
    always return > 0 w/o even trying to reclaim anything. So we should give
    up immediately if killed instead of calling it over and over again in
    vain.
    
    Signed-off-by: Vladimir Davydov <vdavydov at parallels.com>
---
 mm/memcontrol.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/mm/memcontrol.c b/mm/memcontrol.c
index 4bf6d3e736bf..59a2f05a8b92 100644
--- a/mm/memcontrol.c
+++ b/mm/memcontrol.c
@@ -2042,6 +2042,8 @@ static unsigned long mem_cgroup_reclaim(struct mem_cgroup *memcg,
 			drain_all_stock_async(memcg);
 		total += try_to_free_mem_cgroup_pages(memcg, SWAP_CLUSTER_MAX,
 						      gfp_mask, noswap);
+		if (fatal_signal_pending(current))
+			return 1;
 		/*
 		 * Allow limit shrinkers, which are triggered directly
 		 * by userspace, to catch signals and stop reclaim



More information about the Devel mailing list