]> bbs.cooldavid.org Git - net-next-2.6.git/commitdiff
memcg: fix reclaim result checks
authorKAMEZAWA Hiroyuki <kamezawa.hiroyu@jp.fujitsu.com>
Thu, 8 Jan 2009 02:08:09 +0000 (18:08 -0800)
committerLinus Torvalds <torvalds@linux-foundation.org>
Thu, 8 Jan 2009 16:31:06 +0000 (08:31 -0800)
check_under_limit logic was wrong and this check should be against
mem_over_limit rather than mem.

Reported-by: Li Zefan <lizf@cn.fujitsu.com>
Signed-off-by: KAMEZAWA 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: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
mm/memcontrol.c

index 659b0c58f13edce66a09500866b70b74f80a288b..9bf5d7c8ede7f87b771eb6b55e86b935e04fd16b 100644 (file)
@@ -709,17 +709,17 @@ static int __mem_cgroup_try_charge(struct mm_struct *mm,
                 * current usage of the cgroup before giving up
                 *
                 */
-               if (!do_swap_account &&
-                       res_counter_check_under_limit(&mem->res))
-                       continue;
-               if (do_swap_account &&
-                       res_counter_check_under_limit(&mem->memsw))
-                       continue;
+               if (do_swap_account) {
+                       if (res_counter_check_under_limit(&mem_over_limit->res) &&
+                           res_counter_check_under_limit(&mem_over_limit->memsw))
+                               continue;
+               } else if (res_counter_check_under_limit(&mem_over_limit->res))
+                               continue;
 
                if (!nr_retries--) {
                        if (oom) {
-                               mem_cgroup_out_of_memory(mem, gfp_mask);
-                               mem->last_oom_jiffies = jiffies;
+                               mem_cgroup_out_of_memory(mem_over_limit, gfp_mask);
+                               mem_over_limit->last_oom_jiffies = jiffies;
                        }
                        goto nomem;
                }