diff --git a/mm/memcontrol.c b/mm/memcontrol.c index aa66cc4c9e79b1654db117f63256544bf9500683..9537e1389ee6a3551064bcfe58938cddc5a2d908 100644 --- a/mm/memcontrol.c +++ b/mm/memcontrol.c @@ -1119,10 +1119,8 @@ static struct mem_cgroup *__mem_cgroup_iter_next(struct mem_cgroup *root, * protected by css_get and the tree walk is rcu safe. */ if (next_css) { - struct mem_cgroup *mem = mem_cgroup_from_css(next_css); - - if (css_tryget(&mem->css)) - return mem; + if ((next_css->flags & CSS_ONLINE) && css_tryget(next_css)) + return mem_cgroup_from_css(next_css); else { prev_css = next_css; goto skip_node;