Commit 72c97e54 authored by Tejun Heo's avatar Tejun Heo

cgroup: add subsystem pointer to cgroup_subsys_state

Currently, given a cgroup_subsys_state, there's no way to find out
which subsystem the css is for, which we'll need to convert the cgroup
controller API to primarily use @css instead of @cgroup.  This patch
adds cgroup_subsys_state->ss which points to the subsystem the @css
belongs to.

While at it, remove the comment about accessing @css->cgroup to
determine the hierarchy.  cgroup core will provide API to traverse
hierarchy of css'es and we don't want subsystems to directly walk
cgroup hierarchies anymore.
Signed-off-by: default avatarTejun Heo <tj@kernel.org>
Acked-by: default avatarLi Zefan <lizefan@huawei.com>
parent 3f798518
...@@ -66,13 +66,12 @@ enum cgroup_subsys_id { ...@@ -66,13 +66,12 @@ enum cgroup_subsys_id {
/* Per-subsystem/per-cgroup state maintained by the system. */ /* Per-subsystem/per-cgroup state maintained by the system. */
struct cgroup_subsys_state { struct cgroup_subsys_state {
/* /* the cgroup that this css is attached to */
* The cgroup that this subsystem is attached to. Useful
* for subsystems that want to know about the cgroup
* hierarchy structure
*/
struct cgroup *cgroup; struct cgroup *cgroup;
/* the cgroup subsystem that this css is attached to */
struct cgroup_subsys *ss;
/* reference count - access via css_[try]get() and css_put() */ /* reference count - access via css_[try]get() and css_put() */
struct percpu_ref refcnt; struct percpu_ref refcnt;
......
...@@ -4186,6 +4186,7 @@ static void init_cgroup_css(struct cgroup_subsys_state *css, ...@@ -4186,6 +4186,7 @@ static void init_cgroup_css(struct cgroup_subsys_state *css,
struct cgroup *cgrp) struct cgroup *cgrp)
{ {
css->cgroup = cgrp; css->cgroup = cgrp;
css->ss = ss;
css->flags = 0; css->flags = 0;
css->id = NULL; css->id = NULL;
if (cgrp == cgroup_dummy_top) if (cgrp == cgroup_dummy_top)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment