summaryrefslogtreecommitdiffstats
path: root/include/linux/cgroup.h
diff options
context:
space:
mode:
authorTejun Heo <tj@kernel.org>2013-08-08 20:11:24 -0400
committerTejun Heo <tj@kernel.org>2013-08-08 20:11:24 -0400
commit67f4c36f83455b253445b2cb28ac9a2c4f85d99a (patch)
tree3c7aecc6fc830799cf36716ea64583cc10cb9d40 /include/linux/cgroup.h
parentf7d58818ba4249f04a83b73aaac135640050bb4f (diff)
cgroup: add cgroup->dummy_css
cgroup subsystem API is being converted to use css (cgroup_subsys_state) as the main handle, which makes things a bit awkward for subsystem agnostic core features - the "cgroup.*" interface files and various iterations - a bit awkward as they don't have a css to use. This patch adds cgroup->dummy_css which has NULL ->ss and whose only role is pointing back to the cgroup. This will be used to support subsystem agnostic features on the coming css based API. css_parent() is updated to handle dummy_css's. Note that css will soon grow its own ->parent field and css_parent() will be made trivial. Signed-off-by: Tejun Heo <tj@kernel.org> Acked-by: Li Zefan <lizefan@huawei.com>
Diffstat (limited to 'include/linux/cgroup.h')
-rw-r--r--include/linux/cgroup.h11
1 files changed, 10 insertions, 1 deletions
diff --git a/include/linux/cgroup.h b/include/linux/cgroup.h
index 5db8138a048..b0d5f53ae5e 100644
--- a/include/linux/cgroup.h
+++ b/include/linux/cgroup.h
@@ -225,6 +225,9 @@ struct cgroup {
struct list_head pidlists;
struct mutex pidlist_mutex;
+ /* dummy css with NULL ->ss, points back to this cgroup */
+ struct cgroup_subsys_state dummy_css;
+
/* For css percpu_ref killing and RCU-protected deletion */
struct rcu_head rcu_head;
struct work_struct destroy_work;
@@ -668,7 +671,13 @@ struct cgroup_subsys_state *css_parent(struct cgroup_subsys_state *css)
{
struct cgroup *parent_cgrp = css->cgroup->parent;
- return parent_cgrp ? parent_cgrp->subsys[css->ss->subsys_id] : NULL;
+ if (!parent_cgrp)
+ return NULL;
+
+ if (css->ss)
+ return parent_cgrp->subsys[css->ss->subsys_id];
+ else
+ return &parent_cgrp->dummy_css;
}
/**