[Devel] [PATCH RHEL7 COMMIT] memcg: fix __GFP_NORETRY check
Vladimir Davydov
vdavydov at virtuozzo.com
Tue Sep 8 08:30:59 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 33087f4cfe0d5048018f11af4d0ae1ebefb90ff3
Author: Vladimir Davydov <vdavydov at parallels.com>
Date: Tue Sep 8 19:30:59 2015 +0400
memcg: fix __GFP_NORETRY check
When backporting mainstream commit 28c34c291e74 I misplaced the
__GFP_NORETRY check by mistake: if this flag is passed we should give up
after the first unsuccessful reclaim attempt, while I placed the check
so that we can retry reclaim many times. Fix that.
Fixes: 8aee40dd982b ("ms/mm: memcontrol: reclaim at least once for __GFP_NORETRY")
Signed-off-by: Vladimir Davydov <vdavydov at parallels.com>
---
mm/memcontrol.c | 8 +++++---
1 file changed, 5 insertions(+), 3 deletions(-)
diff --git a/mm/memcontrol.c b/mm/memcontrol.c
index 0cb329028a29..6a0751f878d3 100644
--- a/mm/memcontrol.c
+++ b/mm/memcontrol.c
@@ -2768,6 +2768,11 @@ static int mem_cgroup_do_charge(struct mem_cgroup *memcg, gfp_t gfp_mask,
ret = mem_cgroup_reclaim(mem_over_limit, gfp_mask, flags);
if (mem_cgroup_margin(mem_over_limit) >= nr_pages)
return CHARGE_RETRY;
+
+ if (gfp_mask & __GFP_NORETRY) {
+ mem_cgroup_inc_failcnt(mem_over_limit, gfp_mask, nr_pages);
+ return CHARGE_WOULDBLOCK;
+ }
/*
* Even though the limit is exceeded at this point, reclaim
* may have been able to free some pages. Retry the charge
@@ -2793,9 +2798,6 @@ 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