diff --git a/mm/memcontrol.c b/mm/memcontrol.c index 8a4159efa3c0b4ca691bd77ffb4e597c08c5c6f1..e0ac636315f8712bd4670c568aa8af0e0a1f641d 100644 --- a/mm/memcontrol.c +++ b/mm/memcontrol.c @@ -6401,6 +6401,10 @@ static int mem_cgroup_do_precharge(unsigned long count) mc.precharge += count; return ret; } + if (ret == -EINTR) { + __mem_cgroup_cancel_charge(root_mem_cgroup, count); + return ret; + } /* Try charges one by one with reclaim */ while (count--) { @@ -6409,8 +6413,11 @@ static int mem_cgroup_do_precharge(unsigned long count) /* * In case of failure, any residual charges against * mc.to will be dropped by mem_cgroup_clear_mc() - * later on. + * later on. However, cancel any charges that are + * bypassed to root right away or they'll be lost. */ + if (ret == -EINTR) + __mem_cgroup_cancel_charge(root_mem_cgroup, 1); if (ret) return ret; mc.precharge++;