diff options
author | KAMEZAWA Hiroyuki <kamezawa.hiroyu@jp.fujitsu.com> | 2011-01-25 15:07:27 -0800 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@suse.de> | 2011-02-17 15:14:36 -0800 |
commit | e0b13612453fee51e01961940c77167ee9b0e7ff (patch) | |
tree | 9cec3d82f6bf5a96e7c3b8557ea73f5398b86b6a /mm | |
parent | f7095bc2220cd6637b62218eab790fffadbee10d (diff) | |
download | lwn-e0b13612453fee51e01961940c77167ee9b0e7ff.tar.gz lwn-e0b13612453fee51e01961940c77167ee9b0e7ff.zip |
memcg: fix account leak at failure of memsw acconting
commit 01c88e2d6b7330c0cc5867fe2297e7d826e1337d upstream.
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>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
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 00bb8a64d028..1654bd460a36 100644 --- a/mm/memcontrol.c +++ b/mm/memcontrol.c @@ -1842,6 +1842,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 |