diff options
author | Lai Jiangshan <laijs@cn.fujitsu.com> | 2009-01-07 21:07:37 -0500 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2009-01-08 11:31:02 -0500 |
commit | b2aa30f7bb381e04c93eed106089ba55553955f1 (patch) | |
tree | eda632102a0bc6e325a24e77a9c2819eab5aeef3 /kernel | |
parent | 2019f634ce5904c19eba4e86f51b1a119a53a9f1 (diff) |
cgroups: don't put struct cgroupfs_root protected by RCU
We don't access struct cgroupfs_root in fast path, so we should not put
struct cgroupfs_root protected by RCU
But the comment in struct cgroup_subsys.root confuse us.
struct cgroup_subsys.root is used in these places:
1 find_css_set(): if (ss->root->subsys_list.next == &ss->sibling)
2 rebind_subsystems(): if (ss->root != &rootnode)
rcu_assign_pointer(ss->root, root);
rcu_assign_pointer(subsys[i]->root, &rootnode);
3 cgroup_has_css_refs(): if (ss->root != cgrp->root)
4 cgroup_init_subsys(): ss->root = &rootnode;
5 proc_cgroupstats_show(): ss->name, ss->root->subsys_bits,
ss->root->number_of_cgroups, !ss->disabled);
6 cgroup_clone(): root = subsys->root;
if ((root != subsys->root) ||
All these place we have held cgroup_lock() or we don't dereference to
struct cgroupfs_root. It's means wo don't need RCU when use struct
cgroup_subsys.root, and we should not put struct cgroupfs_root protected
by RCU.
Signed-off-by: Lai Jiangshan <laijs@cn.fujitsu.com>
Reviewed-by: Paul Menage <menage@google.com>
Cc: KAMEZAWA Hiroyuki <kamezawa.hiroyu@jp.fujitsu.com>
Cc: Pavel Emelyanov <xemul@openvz.org>
Cc: Balbir Singh <balbir@in.ibm.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'kernel')
-rw-r--r-- | kernel/cgroup.c | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/kernel/cgroup.c b/kernel/cgroup.c index a391ab3bdfc6..a288da176e46 100644 --- a/kernel/cgroup.c +++ b/kernel/cgroup.c | |||
@@ -713,7 +713,7 @@ static int rebind_subsystems(struct cgroupfs_root *root, | |||
713 | cgrp->subsys[i] = dummytop->subsys[i]; | 713 | cgrp->subsys[i] = dummytop->subsys[i]; |
714 | cgrp->subsys[i]->cgroup = cgrp; | 714 | cgrp->subsys[i]->cgroup = cgrp; |
715 | list_add(&ss->sibling, &root->subsys_list); | 715 | list_add(&ss->sibling, &root->subsys_list); |
716 | rcu_assign_pointer(ss->root, root); | 716 | ss->root = root; |
717 | if (ss->bind) | 717 | if (ss->bind) |
718 | ss->bind(ss, cgrp); | 718 | ss->bind(ss, cgrp); |
719 | 719 | ||
@@ -725,7 +725,7 @@ static int rebind_subsystems(struct cgroupfs_root *root, | |||
725 | ss->bind(ss, dummytop); | 725 | ss->bind(ss, dummytop); |
726 | dummytop->subsys[i]->cgroup = dummytop; | 726 | dummytop->subsys[i]->cgroup = dummytop; |
727 | cgrp->subsys[i] = NULL; | 727 | cgrp->subsys[i] = NULL; |
728 | rcu_assign_pointer(subsys[i]->root, &rootnode); | 728 | subsys[i]->root = &rootnode; |
729 | list_del(&ss->sibling); | 729 | list_del(&ss->sibling); |
730 | } else if (bit & final_bits) { | 730 | } else if (bit & final_bits) { |
731 | /* Subsystem state should already exist */ | 731 | /* Subsystem state should already exist */ |