aboutsummaryrefslogtreecommitdiffstats
path: root/include
diff options
context:
space:
mode:
authorTejun Heo <tj@kernel.org>2013-08-13 20:22:50 -0400
committerTejun Heo <tj@kernel.org>2013-08-13 20:22:50 -0400
commitf20104de55a212a9742d8df1807f1f29dc95b748 (patch)
treec7686dae4a73615ba67dc6fd4cfe9e7b89cf9708 /include
parent223dbc38d2a8745a93749dc75ed909e274ce075d (diff)
cgroup: replace cgroup->css_kill_cnt with ->nr_css
Currently, css (cgroup_subsys_state) lifetime is tied to that of the associated cgroup. With the planned unified hierarchy, css's will be dynamically created and destroyed within the lifetime of a cgroup. To enable such usages, css's will be individually RCU protected instead of being tied to the cgroup. cgroup->css_kill_cnt is used during cgroup destruction to wait for css reference count disable; however, this model doesn't work once css's lifetimes are managed separately from cgroup's. This patch replaces it with cgroup->nr_css which is an cgroup_mutex protected integer counting the number of attached css's. The count is incremented from online_css() and decremented after refcnt kill is confirmed. If the count reaches zero and the cgroup is marked dead, the second stage of cgroup destruction is kicked off. If a cgroup doesn't have any css attached at the time of rmdir, cgroup_destroy_locked() now invokes the second stage directly as no css kill confirmation would happen. cgroup_offline_fn() - the second step of cgroup destruction - is renamed to cgroup_destroy_css_killed() and now expects to be called with cgroup_mutex held. While this patch changes how css destruction is punted to work items, it shouldn't change any visible behavior. Signed-off-by: Tejun Heo <tj@kernel.org> Acked-by: Li Zefan <lizefan@huawei.com>
Diffstat (limited to 'include')
-rw-r--r--include/linux/cgroup.h4
1 files changed, 3 insertions, 1 deletions
diff --git a/include/linux/cgroup.h b/include/linux/cgroup.h
index eb200b5794e7..80dca872f4d4 100644
--- a/include/linux/cgroup.h
+++ b/include/linux/cgroup.h
@@ -171,6 +171,9 @@ struct cgroup {
171 */ 171 */
172 int id; 172 int id;
173 173
174 /* the number of attached css's */
175 int nr_css;
176
174 /* 177 /*
175 * We link our 'sibling' struct into our parent's 'children'. 178 * We link our 'sibling' struct into our parent's 'children'.
176 * Our children link their 'sibling' into our 'children'. 179 * Our children link their 'sibling' into our 'children'.
@@ -234,7 +237,6 @@ struct cgroup {
234 /* For css percpu_ref killing and RCU-protected deletion */ 237 /* For css percpu_ref killing and RCU-protected deletion */
235 struct rcu_head rcu_head; 238 struct rcu_head rcu_head;
236 struct work_struct destroy_work; 239 struct work_struct destroy_work;
237 atomic_t css_kill_cnt;
238 240
239 /* List of events which userspace want to receive */ 241 /* List of events which userspace want to receive */
240 struct list_head event_list; 242 struct list_head event_list;