diff options
author | Tejun Heo <tj@kernel.org> | 2014-05-16 13:22:48 -0400 |
---|---|---|
committer | Tejun Heo <tj@kernel.org> | 2014-05-16 13:22:48 -0400 |
commit | 5c9d535b893f30266ea29fe377cb9b002fcd76aa (patch) | |
tree | 27b1fd6e16c5b0c0729a93c4924289119033137c /include | |
parent | 3b514d24e200fcdcde0a57c354a51d3677a86743 (diff) |
cgroup: remove css_parent()
cgroup in general is moving towards using cgroup_subsys_state as the
fundamental structural component and css_parent() was introduced to
convert from using cgroup->parent to css->parent. It was quite some
time ago and we're moving forward with making css more prominent.
This patch drops the trivial wrapper css_parent() and let the users
dereference css->parent. While at it, explicitly mark fields of css
which are public and immutable.
v2: New usage from device_cgroup.c converted.
Signed-off-by: Tejun Heo <tj@kernel.org>
Acked-by: Michal Hocko <mhocko@suse.cz>
Acked-by: Neil Horman <nhorman@tuxdriver.com>
Acked-by: "David S. Miller" <davem@davemloft.net>
Acked-by: Li Zefan <lizefan@huawei.com>
Cc: Vivek Goyal <vgoyal@redhat.com>
Cc: Jens Axboe <axboe@kernel.dk>
Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>
Cc: Johannes Weiner <hannes@cmpxchg.org>
Diffstat (limited to 'include')
-rw-r--r-- | include/linux/cgroup.h | 29 |
1 files changed, 11 insertions, 18 deletions
diff --git a/include/linux/cgroup.h b/include/linux/cgroup.h index 1737db0c63fe..2549493d518d 100644 --- a/include/linux/cgroup.h +++ b/include/linux/cgroup.h | |||
@@ -48,22 +48,28 @@ enum cgroup_subsys_id { | |||
48 | }; | 48 | }; |
49 | #undef SUBSYS | 49 | #undef SUBSYS |
50 | 50 | ||
51 | /* Per-subsystem/per-cgroup state maintained by the system. */ | 51 | /* |
52 | * Per-subsystem/per-cgroup state maintained by the system. This is the | ||
53 | * fundamental structural building block that controllers deal with. | ||
54 | * | ||
55 | * Fields marked with "PI:" are public and immutable and may be accessed | ||
56 | * directly without synchronization. | ||
57 | */ | ||
52 | struct cgroup_subsys_state { | 58 | struct cgroup_subsys_state { |
53 | /* the cgroup that this css is attached to */ | 59 | /* PI: the cgroup that this css is attached to */ |
54 | struct cgroup *cgroup; | 60 | struct cgroup *cgroup; |
55 | 61 | ||
56 | /* the cgroup subsystem that this css is attached to */ | 62 | /* PI: the cgroup subsystem that this css is attached to */ |
57 | struct cgroup_subsys *ss; | 63 | struct cgroup_subsys *ss; |
58 | 64 | ||
59 | /* reference count - access via css_[try]get() and css_put() */ | 65 | /* reference count - access via css_[try]get() and css_put() */ |
60 | struct percpu_ref refcnt; | 66 | struct percpu_ref refcnt; |
61 | 67 | ||
62 | /* the parent css */ | 68 | /* PI: the parent css */ |
63 | struct cgroup_subsys_state *parent; | 69 | struct cgroup_subsys_state *parent; |
64 | 70 | ||
65 | /* | 71 | /* |
66 | * Subsys-unique ID. 0 is unused and root is always 1. The | 72 | * PI: Subsys-unique ID. 0 is unused and root is always 1. The |
67 | * matching css can be looked up using css_from_id(). | 73 | * matching css can be looked up using css_from_id(). |
68 | */ | 74 | */ |
69 | int id; | 75 | int id; |
@@ -670,19 +676,6 @@ struct cgroup_subsys { | |||
670 | #undef SUBSYS | 676 | #undef SUBSYS |
671 | 677 | ||
672 | /** | 678 | /** |
673 | * css_parent - find the parent css | ||
674 | * @css: the target cgroup_subsys_state | ||
675 | * | ||
676 | * Return the parent css of @css. This function is guaranteed to return | ||
677 | * non-NULL parent as long as @css isn't the root. | ||
678 | */ | ||
679 | static inline | ||
680 | struct cgroup_subsys_state *css_parent(struct cgroup_subsys_state *css) | ||
681 | { | ||
682 | return css->parent; | ||
683 | } | ||
684 | |||
685 | /** | ||
686 | * task_css_set_check - obtain a task's css_set with extra access conditions | 679 | * task_css_set_check - obtain a task's css_set with extra access conditions |
687 | * @task: the task to obtain css_set for | 680 | * @task: the task to obtain css_set for |
688 | * @__c: extra condition expression to be passed to rcu_dereference_check() | 681 | * @__c: extra condition expression to be passed to rcu_dereference_check() |