diff options
author | Hugh Dickins <hughd@google.com> | 2014-01-23 15:53:32 -0800 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2014-02-13 13:50:11 -0800 |
commit | ab9682ffb14f69c7547f5f13cd8cf5f37a76747a (patch) | |
tree | abd7bbc64e9e71965447f8b2ea86be1ea172fa5a /mm | |
parent | 4d712df1169cf3e3cd08395e25eea9fcbe39e354 (diff) | |
download | lwn-ab9682ffb14f69c7547f5f13cd8cf5f37a76747a.tar.gz lwn-ab9682ffb14f69c7547f5f13cd8cf5f37a76747a.zip |
mm/memcg: iteration skip memcgs not yet fully initialized
commit d8ad30559715ce97afb7d1a93a12fd90e8fff312 upstream.
It is surprising that the mem_cgroup iterator can return memcgs which
have not yet been fully initialized. By accident (or trial and error?)
this appears not to present an actual problem; but it may be better to
prevent such surprises, by skipping memcgs not yet online.
Signed-off-by: Hugh Dickins <hughd@google.com>
Cc: Tejun Heo <tj@kernel.org>
Acked-by: Michal Hocko <mhocko@suse.cz>
Cc: Johannes Weiner <hannes@cmpxchg.org>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'mm')
-rw-r--r-- | mm/memcontrol.c | 6 |
1 files changed, 2 insertions, 4 deletions
diff --git a/mm/memcontrol.c b/mm/memcontrol.c index e0e979276df0..b55eb75cdf4d 100644 --- a/mm/memcontrol.c +++ b/mm/memcontrol.c @@ -1081,10 +1081,8 @@ skip_node: * 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; |