aboutsummaryrefslogtreecommitdiffstats
path: root/kernel
diff options
context:
space:
mode:
authorTejun Heo <tj@kernel.org>2014-05-14 09:15:01 -0400
committerTejun Heo <tj@kernel.org>2014-05-14 09:15:01 -0400
commit4e4e28472365f8c7a7c55f6b5706f68bc40c5b13 (patch)
tree537d6c32f129fd90347463f5e645c6dfe51f5860 /kernel
parent9e4173e1f24fa3bd562f13b92ee34c7dfb1db7c9 (diff)
cgroup: move cgroup->sibling unlinking to cgroup_put()
Move cgroup->sibling unlinking from cgroup_destroy_css_killed() to cgroup_put(). This is later but still before the RCU grace period, so it doesn't break css_next_child() although there now is a larger window in which a dead cgroup is visible during css iteration. As css iteration always could have included offline csses, this doesn't affect correctness; however, it does make css_next_child() fall back to reiterting mode more often. This also makes cgroup_put() directly take cgroup_mutex, which limits where it can be called from. These are not immediately problematic and will be dealt with later. This change enables simplification of cgroup destruction path. Signed-off-by: Tejun Heo <tj@kernel.org> Acked-by: Li Zefan <lizefan@huawei.com>
Diffstat (limited to 'kernel')
-rw-r--r--kernel/cgroup.c8
1 files changed, 5 insertions, 3 deletions
diff --git a/kernel/cgroup.c b/kernel/cgroup.c
index 061569fba245..e9aa2a51ca68 100644
--- a/kernel/cgroup.c
+++ b/kernel/cgroup.c
@@ -1056,6 +1056,11 @@ static void cgroup_put(struct cgroup *cgrp)
1056 if (WARN_ON_ONCE(cgrp->parent && !cgroup_is_dead(cgrp))) 1056 if (WARN_ON_ONCE(cgrp->parent && !cgroup_is_dead(cgrp)))
1057 return; 1057 return;
1058 1058
1059 /* delete this cgroup from parent->children */
1060 mutex_lock(&cgroup_mutex);
1061 list_del_rcu(&cgrp->sibling);
1062 mutex_unlock(&cgroup_mutex);
1063
1059 cgroup_idr_remove(&cgrp->root->cgroup_idr, cgrp->id); 1064 cgroup_idr_remove(&cgrp->root->cgroup_idr, cgrp->id);
1060 cgrp->id = -1; 1065 cgrp->id = -1;
1061 1066
@@ -4561,9 +4566,6 @@ static void cgroup_destroy_css_killed(struct cgroup *cgrp)
4561{ 4566{
4562 lockdep_assert_held(&cgroup_mutex); 4567 lockdep_assert_held(&cgroup_mutex);
4563 4568
4564 /* delete this cgroup from parent->children */
4565 list_del_rcu(&cgrp->sibling);
4566
4567 cgroup_put(cgrp); 4569 cgroup_put(cgrp);
4568} 4570}
4569 4571