[Devel] [PATCH RHEL7 COMMIT] ms/mm: memcontrol: reclaim at least once for __GFP_NORETRY

Konstantin Khorenko khorenko at virtuozzo.com
Mon Aug 31 06:09:47 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.4
------>
commit 8aee40dd982b476c208aee78e19cd756f2dac8a7
Author: Johannes Weiner <hannes at cmpxchg.org>
Date:   Mon Aug 31 17:09:47 2015 +0400

    ms/mm: memcontrol: reclaim at least once for __GFP_NORETRY
    
    Currently, __GFP_NORETRY tries charging once and gives up before even
    trying to reclaim.  Bring the behavior on par with the page allocator
    and reclaim at least once before giving up.
    
    Signed-off-by: Johannes Weiner <hannes at cmpxchg.org>
    Acked-by: Michal Hocko <mhocko at suse.cz>
    Cc: Hugh Dickins <hughd at google.com>
    Cc: Tejun Heo <tj at kernel.org>
    Cc: Vladimir Davydov <vdavydov at parallels.com>
    Signed-off-by: Andrew Morton <akpm at linux-foundation.org>
    Signed-off-by: Linus Torvalds <torvalds at linux-foundation.org>
    (cherry picked from commit 28c34c291e746aab1c2bfd6d6609b2e47fa0978b)
    Signed-off-by: Vladimir Davydov <vdavydov at parallels.com>
    
    Conflicts:
    	mm/memcontrol.c
---
 mm/memcontrol.c | 8 +++-----
 1 file changed, 3 insertions(+), 5 deletions(-)

diff --git a/mm/memcontrol.c b/mm/memcontrol.c
index 7fc2931..52c7871 100644
--- a/mm/memcontrol.c
+++ b/mm/memcontrol.c
@@ -2754,11 +2754,6 @@ static int mem_cgroup_do_charge(struct mem_cgroup *memcg, gfp_t gfp_mask,
 		return CHARGE_WOULDBLOCK;
 	}
 
-	if (gfp_mask & __GFP_NORETRY) {
-		mem_cgroup_inc_failcnt(mem_over_limit, gfp_mask, nr_pages);
-		return CHARGE_NOMEM;
-	}
-
 	ret = mem_cgroup_reclaim(mem_over_limit, gfp_mask, flags);
 	if (mem_cgroup_margin(mem_over_limit) >= nr_pages)
 		return CHARGE_RETRY;
@@ -2787,6 +2782,9 @@ static int mem_cgroup_do_charge(struct mem_cgroup *memcg, gfp_t gfp_mask,
 
 	mem_cgroup_inc_failcnt(mem_over_limit, gfp_mask, nr_pages);
 
+	if (gfp_mask & __GFP_NORETRY)
+		return CHARGE_NOMEM;
+
 	/* check OOM */
 	if (!mem_cgroup_handle_oom(mem_over_limit, gfp_mask, get_order(csize)))
 		return CHARGE_OOM_DIE;



More information about the Devel mailing list