diff options
author | KAMEZAWA Hiroyuki <kamezawa.hiroyu@jp.fujitsu.com> | 2011-01-25 18:07:27 -0500 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2011-01-25 19:50:03 -0500 |
commit | 01c88e2d6b7330c0cc5867fe2297e7d826e1337d (patch) | |
tree | 0a905aa1558af7fd401d768ead121e2b11a4a2f4 /mm | |
parent | 28bd65781c848d95ba6a7f58b5c4b8265a804ec6 (diff) |
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 <kamezawa.hiroyu@jp.fujitsu.com>
Reviewed-by: Johannes Weiner <hannes@cmpxchg.org>
Acked-by: Daisuke Nishimura <nishimura@mxp.nes.nec.co.jp>
Cc: Balbir Singh <balbir@in.ibm.com>
Cc: <stable@kernel.org> [2.6.36+]
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'mm')
-rw-r--r-- | mm/memcontrol.c | 1 |
1 files changed, 1 insertions, 0 deletions
diff --git a/mm/memcontrol.c b/mm/memcontrol.c index 4fcf47a62550..1eb1a04f874c 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, | |||
1832 | if (likely(!ret)) | 1832 | if (likely(!ret)) |
1833 | return CHARGE_OK; | 1833 | return CHARGE_OK; |
1834 | 1834 | ||
1835 | res_counter_uncharge(&mem->res, csize); | ||
1835 | mem_over_limit = mem_cgroup_from_res_counter(fail_res, memsw); | 1836 | mem_over_limit = mem_cgroup_from_res_counter(fail_res, memsw); |
1836 | flags |= MEM_CGROUP_RECLAIM_NOSWAP; | 1837 | flags |= MEM_CGROUP_RECLAIM_NOSWAP; |
1837 | } else | 1838 | } else |