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 <[email protected]>
---
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;
--
2.1.4
_______________________________________________
Devel mailing list
[email protected]
https://lists.openvz.org/mailman/listinfo/devel