summaryrefslogtreecommitdiffstats
path: root/mm/memcontrol.c
diff options
context:
space:
mode:
Diffstat (limited to 'mm/memcontrol.c')
-rw-r--r--mm/memcontrol.c9
1 files changed, 8 insertions, 1 deletions
diff --git a/mm/memcontrol.c b/mm/memcontrol.c
index 8a4159efa3c0..e0ac636315f8 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++;
OpenPOWER on IntegriCloud