Commit ad4ca5f4b70236dab5e457ff6567d36f75d2e7c5

Authored by Kirill A. Shutemov
Committed by Linus Torvalds
1 parent f241e6607b

memcg: fix thresholds with use_hierarchy == 1

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>

Showing 1 changed file with 7 additions and 3 deletions Side-by-side Diff

... ... @@ -3587,9 +3587,13 @@
3587 3587  
3588 3588 static void mem_cgroup_threshold(struct mem_cgroup *memcg)
3589 3589 {
3590   - __mem_cgroup_threshold(memcg, false);
3591   - if (do_swap_account)
3592   - __mem_cgroup_threshold(memcg, true);
  3590 + while (memcg) {
  3591 + __mem_cgroup_threshold(memcg, false);
  3592 + if (do_swap_account)
  3593 + __mem_cgroup_threshold(memcg, true);
  3594 +
  3595 + memcg = parent_mem_cgroup(memcg);
  3596 + }
3593 3597 }
3594 3598  
3595 3599 static int compare_thresholds(const void *a, const void *b)