summaryrefslogtreecommitdiffstats
path: root/kernel/cgroup.c
diff options
context:
space:
mode:
authorTejun Heo2013-08-09 02:11:24 +0200
committerTejun Heo2013-08-09 02:11:24 +0200
commitf48e3924dca268c677c4e338e5d91ad9e6fe6b9e (patch)
tree8056aa4023c6a359851b27677560948835a59465 /kernel/cgroup.c
parentcgroup: convert cgroup_next_sibling() to cgroup_next_child() (diff)
downloadkernel-qcow2-linux-f48e3924dca268c677c4e338e5d91ad9e6fe6b9e.tar.gz
kernel-qcow2-linux-f48e3924dca268c677c4e338e5d91ad9e6fe6b9e.tar.xz
kernel-qcow2-linux-f48e3924dca268c677c4e338e5d91ad9e6fe6b9e.zip
cgroup: always use cgroup_next_child() to walk the children list
There are several places where the children list is accessed directly. This patch converts those places to use cgroup_next_child(). This will help updating the hierarchy iterators to use @css instead of @cgrp. While cgroup_next_child() can be heavy in pathological cases - e.g. a lot of dead children, this shouldn't cause any noticeable behavior differences. Signed-off-by: Tejun Heo <tj@kernel.org> Acked-by: Li Zefan <lizefan@huawei.com>
Diffstat (limited to 'kernel/cgroup.c')
-rw-r--r--kernel/cgroup.c7
1 files changed, 3 insertions, 4 deletions
diff --git a/kernel/cgroup.c b/kernel/cgroup.c
index dd55244952bd..2b7354faaca7 100644
--- a/kernel/cgroup.c
+++ b/kernel/cgroup.c
@@ -3112,7 +3112,7 @@ struct cgroup *cgroup_next_descendant_pre(struct cgroup *pos,
pos = cgroup;
/* visit the first child if exists */
- next = list_first_or_null_rcu(&pos->children, struct cgroup, sibling);
+ next = cgroup_next_child(NULL, pos);
if (next)
return next;
@@ -3151,7 +3151,7 @@ struct cgroup *cgroup_rightmost_descendant(struct cgroup *pos)
last = pos;
/* ->prev isn't RCU safe, walk ->next till the end */
pos = NULL;
- list_for_each_entry_rcu(tmp, &last->children, sibling)
+ cgroup_for_each_child(tmp, last)
pos = tmp;
} while (pos);
@@ -3165,8 +3165,7 @@ static struct cgroup *cgroup_leftmost_descendant(struct cgroup *pos)
do {
last = pos;
- pos = list_first_or_null_rcu(&pos->children, struct cgroup,
- sibling);
+ pos = cgroup_next_child(NULL, pos);
} while (pos);
return last;