]> bbs.cooldavid.org Git - net-next-2.6.git/commitdiff
memcg: fix thresholds with use_hierarchy == 1
authorKirill A. Shutemov <kirill@shutemov.name>
Thu, 7 Oct 2010 19:59:27 +0000 (12:59 -0700)
committerLinus Torvalds <torvalds@linux-foundation.org>
Thu, 7 Oct 2010 20:31:21 +0000 (13:31 -0700)
We need to check parent's thresholds if parent has use_hierarchy == 1 to
be sure that parent's threshold events will be triggered even if parent
itself is not active (no MEM_CGROUP_EVENTS).

Signed-off-by: Kirill A. Shutemov <kirill@shutemov.name>
Reviewed-by: Daisuke Nishimura <nishimura@mxp.nes.nec.co.jp>
Acked-by: KAMEZAWA Hiroyuki <kamezawa.hiroyu@jp.fujitsu.com>
Acked-by: Balbir Singh <balbir@linux.vnet.ibm.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
mm/memcontrol.c

index 3eed583895a6f31eb434a252697371c7daa6bbd4..9be3cf8a5da462d4b1b4103eef61f8d5a9a6e06c 100644 (file)
@@ -3587,9 +3587,13 @@ unlock:
 
 static void mem_cgroup_threshold(struct mem_cgroup *memcg)
 {
-       __mem_cgroup_threshold(memcg, false);
-       if (do_swap_account)
-               __mem_cgroup_threshold(memcg, true);
+       while (memcg) {
+               __mem_cgroup_threshold(memcg, false);
+               if (do_swap_account)
+                       __mem_cgroup_threshold(memcg, true);
+
+               memcg = parent_mem_cgroup(memcg);
+       }
 }
 
 static int compare_thresholds(const void *a, const void *b)