[Devel] [PATCH RHEL7 COMMIT] ms/memcg: do not call high reclaim if !__GFP_WAIT

Konstantin Khorenko khorenko at virtuozzo.com
Fri May 29 03:53:11 PDT 2015


The commit is pushed to "branch-rh7-3.10.0-123.1.2-ovz" and will appear at https://src.openvz.org/scm/ovz/vzkernel.git
after rh7-3.10.0-123.1.2.vz7.5.7
------>
commit c238509b21ac68629812f1a27d7c4e95a75a815a
Author: Vladimir Davydov <vdavydov at parallels.com>
Date:   Fri May 29 14:53:11 2015 +0400

    ms/memcg: do not call high reclaim if !__GFP_WAIT
    
    Sent to ms, not applied yet:
    https://lkml.org/lkml/2015/5/28/528
    
    When trimming memcg consumption excess (see memory.high), we call
    try_to_free_mem_cgroup_pages without checking if we are allowed to sleep
    in the current context, which can result in a deadlock. Fix this.
    
    Signed-off-by: Vladimir Davydov <vdavydov at parallels.com>
    Cc: Johannes Weiner <hannes at cmpxchg.org>
    Cc: Michal Hocko <mhocko at suse.cz>
---
 mm/memcontrol.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/mm/memcontrol.c b/mm/memcontrol.c
index 6409fb2..9292893 100644
--- a/mm/memcontrol.c
+++ b/mm/memcontrol.c
@@ -2800,6 +2800,8 @@ static int mem_cgroup_do_charge(struct mem_cgroup *memcg, gfp_t gfp_mask,
 	return CHARGE_RETRY;
 
 done:
+	if (!(gfp_mask & __GFP_WAIT))
+		goto out;
 	/*
 	 * If the hierarchy is above the normal consumption range,
 	 * make the charging task trim their excess contribution.
@@ -2809,6 +2811,7 @@ done:
 			continue;
 		try_to_free_mem_cgroup_pages(memcg, nr_pages, gfp_mask, false);
 	} while ((memcg = parent_mem_cgroup(memcg)));
+out:
 	return CHARGE_OK;
 }
 



More information about the Devel mailing list