aboutsummaryrefslogtreecommitdiffstats
path: root/kernel/cgroup.c
diff options
context:
space:
mode:
authorTejun Heo <tj@kernel.org>2013-08-08 20:11:26 -0400
committerTejun Heo <tj@kernel.org>2013-08-08 20:11:26 -0400
commitd515876e9d951d8cf7fc7c90db2967664bdc89ee (patch)
tree8cc106323aa25a60039c75522c9712dd18183c24 /kernel/cgroup.c
parent492eb21b98f88e411a8bb43d6edcd7d7022add10 (diff)
cgroup: relocate cgroup_advance_iter()
For some reason, cgroup_advance_iter() is standing lonely all away from its iter comrades. Relocate it. This is cosmetic. 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.c48
1 files changed, 24 insertions, 24 deletions
diff --git a/kernel/cgroup.c b/kernel/cgroup.c
index 91eac33fac86..d56d9363d4b3 100644
--- a/kernel/cgroup.c
+++ b/kernel/cgroup.c
@@ -2982,30 +2982,6 @@ int cgroup_task_count(const struct cgroup *cgrp)
2982} 2982}
2983 2983
2984/* 2984/*
2985 * Advance a list_head iterator. The iterator should be positioned at
2986 * the start of a css_set
2987 */
2988static void cgroup_advance_iter(struct cgroup *cgrp, struct cgroup_iter *it)
2989{
2990 struct list_head *l = it->cset_link;
2991 struct cgrp_cset_link *link;
2992 struct css_set *cset;
2993
2994 /* Advance to the next non-empty css_set */
2995 do {
2996 l = l->next;
2997 if (l == &cgrp->cset_links) {
2998 it->cset_link = NULL;
2999 return;
3000 }
3001 link = list_entry(l, struct cgrp_cset_link, cset_link);
3002 cset = link->cset;
3003 } while (list_empty(&cset->tasks));
3004 it->cset_link = l;
3005 it->task = cset->tasks.next;
3006}
3007
3008/*
3009 * To reduce the fork() overhead for systems that are not actually 2985 * To reduce the fork() overhead for systems that are not actually
3010 * using their cgroups capability, we don't maintain the lists running 2986 * using their cgroups capability, we don't maintain the lists running
3011 * through each css_set to its tasks until we see the list actually 2987 * through each css_set to its tasks until we see the list actually
@@ -3223,6 +3199,30 @@ css_next_descendant_post(struct cgroup_subsys_state *pos,
3223} 3199}
3224EXPORT_SYMBOL_GPL(css_next_descendant_post); 3200EXPORT_SYMBOL_GPL(css_next_descendant_post);
3225 3201
3202/*
3203 * Advance a list_head iterator. The iterator should be positioned at
3204 * the start of a css_set
3205 */
3206static void cgroup_advance_iter(struct cgroup *cgrp, struct cgroup_iter *it)
3207{
3208 struct list_head *l = it->cset_link;
3209 struct cgrp_cset_link *link;
3210 struct css_set *cset;
3211
3212 /* Advance to the next non-empty css_set */
3213 do {
3214 l = l->next;
3215 if (l == &cgrp->cset_links) {
3216 it->cset_link = NULL;
3217 return;
3218 }
3219 link = list_entry(l, struct cgrp_cset_link, cset_link);
3220 cset = link->cset;
3221 } while (list_empty(&cset->tasks));
3222 it->cset_link = l;
3223 it->task = cset->tasks.next;
3224}
3225
3226void cgroup_iter_start(struct cgroup *cgrp, struct cgroup_iter *it) 3226void cgroup_iter_start(struct cgroup *cgrp, struct cgroup_iter *it)
3227 __acquires(css_set_lock) 3227 __acquires(css_set_lock)
3228{ 3228{