Commit 88700756 authored by KAMEZAWA Hiroyuki's avatar KAMEZAWA Hiroyuki Committed by Linus Torvalds

memcg: fix reclaim result checks

check_under_limit logic was wrong and this check should be against
mem_over_limit rather than mem.
Reported-by: default avatarLi Zefan <lizf@cn.fujitsu.com>
Signed-off-by: default avatarKAMEZAWA Hiroyuki <kamezawa.hiroyu@jp.fujitsu.com>
Cc: Balbir Singh <balbir@in.ibm.com>
Cc: Daisuke Nishimura <nishimura@mxp.nes.nec.co.jp>
Cc: Badari Pulavarty <pbadari@us.ibm.com>
Cc: Jan Blunck <jblunck@suse.de>
Cc: Hirokazu Takahashi <taka@valinux.co.jp>
Cc: Nick Piggin <nickpiggin@yahoo.com.au>
Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
parent a636b327
...@@ -709,17 +709,17 @@ static int __mem_cgroup_try_charge(struct mm_struct *mm, ...@@ -709,17 +709,17 @@ static int __mem_cgroup_try_charge(struct mm_struct *mm,
* current usage of the cgroup before giving up * current usage of the cgroup before giving up
* *
*/ */
if (!do_swap_account && if (do_swap_account) {
res_counter_check_under_limit(&mem->res)) if (res_counter_check_under_limit(&mem_over_limit->res) &&
continue; res_counter_check_under_limit(&mem_over_limit->memsw))
if (do_swap_account && continue;
res_counter_check_under_limit(&mem->memsw)) } else if (res_counter_check_under_limit(&mem_over_limit->res))
continue; continue;
if (!nr_retries--) { if (!nr_retries--) {
if (oom) { if (oom) {
mem_cgroup_out_of_memory(mem, gfp_mask); mem_cgroup_out_of_memory(mem_over_limit, gfp_mask);
mem->last_oom_jiffies = jiffies; mem_over_limit->last_oom_jiffies = jiffies;
} }
goto nomem; goto nomem;
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment