mirror of
git://git.kernel.org/pub/scm/linux/kernel/git/xiang/erofs.git
synced 2026-11-14 05:52:16 +01:00
mm/memcg: iteration skip memcgs not yet fully initialized
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 <[email protected]> Cc: Tejun Heo <[email protected]> Acked-by: Michal Hocko <[email protected]> Cc: Johannes Weiner <[email protected]> Cc: <[email protected]> [3.12+] Signed-off-by: Andrew Morton <[email protected]> Signed-off-by: Linus Torvalds <[email protected]>
This commit is contained in:
1 parent
d2ab70aaae
commit
d8ad305597
1 file changed
+2
-4
+2
-4
@@ -1119,10 +1119,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;
|
||||
|
||||
Reference in new issue
Block a user