Commit f5f415c1 authored by David Rientjes's avatar David Rientjes Committed by Greg Kroah-Hartman

mm, memcg: do not retry precharge charges

commit 3674534b upstream.

When memory.move_charge_at_immigrate is enabled and precharges are
depleted during move, mem_cgroup_move_charge_pte_range() will attempt to
increase the size of the precharge.

Prevent precharges from ever looping by setting __GFP_NORETRY.  This was
probably the intention of the GFP_KERNEL & ~__GFP_NORETRY, which is
pointless as written.

Fixes: 0029e19e ("mm: memcontrol: remove explicit OOM parameter in charge path")
Link: http://lkml.kernel.org/r/alpine.DEB.2.10.1701130208510.69402@chino.kir.corp.google.comSigned-off-by: default avatarDavid Rientjes <rientjes@google.com>
Acked-by: default avatarMichal Hocko <mhocko@suse.com>
Cc: Johannes Weiner <hannes@cmpxchg.org>
Cc: Vladimir Davydov <vdavydov.dev@gmail.com>
Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
parent 98185d4b
...@@ -4360,9 +4360,9 @@ static int mem_cgroup_do_precharge(unsigned long count) ...@@ -4360,9 +4360,9 @@ static int mem_cgroup_do_precharge(unsigned long count)
return ret; return ret;
} }
/* Try charges one by one with reclaim */ /* Try charges one by one with reclaim, but do not retry */
while (count--) { while (count--) {
ret = try_charge(mc.to, GFP_KERNEL & ~__GFP_NORETRY, 1); ret = try_charge(mc.to, GFP_KERNEL | __GFP_NORETRY, 1);
if (ret) if (ret)
return ret; return ret;
mc.precharge++; mc.precharge++;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment