commit: 01c88e2d6b7330c0cc5867fe2297e7d826e1337d
From: KAMEZAWA Hiroyuki <[email protected]>
Date: Tue, 25 Jan 2011 15:07:27 -0800
Subject: [PATCH] memcg: fix account leak at failure of memsw acconting
Commit 4b53433468 ("memcg: clean up try_charge main loop") removes a
cancel of charge at case: memory charge-> success. mem+swap charge->
failure.
This leaks usage of memory. Fix it.
Signed-off-by: KAMEZAWA Hiroyuki <[email protected]>
Reviewed-by: Johannes Weiner <[email protected]>
Acked-by: Daisuke Nishimura <[email protected]>
Cc: Balbir Singh <[email protected]>
Cc: <[email protected]> [2.6.36+]
Signed-off-by: Andrew Morton <[email protected]>
Signed-off-by: Linus Torvalds <[email protected]>
---
mm/memcontrol.c | 1 +
1 files changed, 1 insertions(+), 0 deletions(-)
diff --git a/mm/memcontrol.c b/mm/memcontrol.c
index 4fcf47a..1eb1a04 100644
--- a/mm/memcontrol.c
+++ b/mm/memcontrol.c
@@ -1832,6 +1832,7 @@ static int __mem_cgroup_do_charge(struct mem_cgroup *mem,
gfp_t gfp_mask,
if (likely(!ret))
return CHARGE_OK;
+ res_counter_uncharge(&mem->res, csize);
mem_over_limit = mem_cgroup_from_res_counter(fail_res, memsw);
flags |= MEM_CGROUP_RECLAIM_NOSWAP;
} else
_______________________________________________
stable mailing list
[email protected]
http://linux.kernel.org/mailman/listinfo/stable