diff options
author | Tejun Heo <tj@kernel.org> | 2013-08-08 20:11:24 -0400 |
---|---|---|
committer | Tejun Heo <tj@kernel.org> | 2013-08-08 20:11:24 -0400 |
commit | 182446d087906de40e514573a92a97b203695f71 (patch) | |
tree | 6aee96219c82d0a64b9d389c50666c1ce0ec27ee /kernel/sched/cpuacct.c | |
parent | 67f4c36f83455b253445b2cb28ac9a2c4f85d99a (diff) |
cgroup: pass around cgroup_subsys_state instead of cgroup in file methods
cgroup is currently in the process of transitioning to using struct
cgroup_subsys_state * as the primary handle instead of struct cgroup.
Please see the previous commit which converts the subsystem methods
for rationale.
This patch converts all cftype file operations to take @css instead of
@cgroup. cftypes for the cgroup core files don't have their subsytem
pointer set. These will automatically use the dummy_css added by the
previous patch and can be converted the same way.
Most subsystem conversions are straight forwards but there are some
interesting ones.
* freezer: update_if_frozen() is also converted to take @css instead
of @cgroup for consistency. This will make the code look simpler
too once iterators are converted to use css.
* memory/vmpressure: mem_cgroup_from_css() needs to be exported to
vmpressure while mem_cgroup_from_cont() can be made static.
Updated accordingly.
* cpu: cgroup_tg() doesn't have any user left. Removed.
* cpuacct: cgroup_ca() doesn't have any user left. Removed.
* hugetlb: hugetlb_cgroup_form_cgroup() doesn't have any user left.
Removed.
* net_cls: cgrp_cls_state() doesn't have any user left. Removed.
Signed-off-by: Tejun Heo <tj@kernel.org>
Acked-by: Li Zefan <lizefan@huawei.com>
Acked-by: Michal Hocko <mhocko@suse.cz>
Acked-by: Vivek Goyal <vgoyal@redhat.com>
Acked-by: Aristeu Rozanski <aris@redhat.com>
Acked-by: Daniel Wagner <daniel.wagner@bmw-carit.de>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Ingo Molnar <mingo@redhat.com>
Cc: Johannes Weiner <hannes@cmpxchg.org>
Cc: Balbir Singh <bsingharora@gmail.com>
Cc: Matt Helsley <matthltc@us.ibm.com>
Cc: Jens Axboe <axboe@kernel.dk>
Cc: Steven Rostedt <rostedt@goodmis.org>
Diffstat (limited to 'kernel/sched/cpuacct.c')
-rw-r--r-- | kernel/sched/cpuacct.c | 28 |
1 files changed, 11 insertions, 17 deletions
diff --git a/kernel/sched/cpuacct.c b/kernel/sched/cpuacct.c index 1b784d9b3630..f64722ff0299 100644 --- a/kernel/sched/cpuacct.c +++ b/kernel/sched/cpuacct.c | |||
@@ -38,12 +38,6 @@ static inline struct cpuacct *css_ca(struct cgroup_subsys_state *css) | |||
38 | return css ? container_of(css, struct cpuacct, css) : NULL; | 38 | return css ? container_of(css, struct cpuacct, css) : NULL; |
39 | } | 39 | } |
40 | 40 | ||
41 | /* return cpu accounting group corresponding to this container */ | ||
42 | static inline struct cpuacct *cgroup_ca(struct cgroup *cgrp) | ||
43 | { | ||
44 | return css_ca(cgroup_css(cgrp, cpuacct_subsys_id)); | ||
45 | } | ||
46 | |||
47 | /* return cpu accounting group to which this task belongs */ | 41 | /* return cpu accounting group to which this task belongs */ |
48 | static inline struct cpuacct *task_ca(struct task_struct *tsk) | 42 | static inline struct cpuacct *task_ca(struct task_struct *tsk) |
49 | { | 43 | { |
@@ -138,9 +132,9 @@ static void cpuacct_cpuusage_write(struct cpuacct *ca, int cpu, u64 val) | |||
138 | } | 132 | } |
139 | 133 | ||
140 | /* return total cpu usage (in nanoseconds) of a group */ | 134 | /* return total cpu usage (in nanoseconds) of a group */ |
141 | static u64 cpuusage_read(struct cgroup *cgrp, struct cftype *cft) | 135 | static u64 cpuusage_read(struct cgroup_subsys_state *css, struct cftype *cft) |
142 | { | 136 | { |
143 | struct cpuacct *ca = cgroup_ca(cgrp); | 137 | struct cpuacct *ca = css_ca(css); |
144 | u64 totalcpuusage = 0; | 138 | u64 totalcpuusage = 0; |
145 | int i; | 139 | int i; |
146 | 140 | ||
@@ -150,10 +144,10 @@ static u64 cpuusage_read(struct cgroup *cgrp, struct cftype *cft) | |||
150 | return totalcpuusage; | 144 | return totalcpuusage; |
151 | } | 145 | } |
152 | 146 | ||
153 | static int cpuusage_write(struct cgroup *cgrp, struct cftype *cftype, | 147 | static int cpuusage_write(struct cgroup_subsys_state *css, struct cftype *cft, |
154 | u64 reset) | 148 | u64 reset) |
155 | { | 149 | { |
156 | struct cpuacct *ca = cgroup_ca(cgrp); | 150 | struct cpuacct *ca = css_ca(css); |
157 | int err = 0; | 151 | int err = 0; |
158 | int i; | 152 | int i; |
159 | 153 | ||
@@ -169,10 +163,10 @@ out: | |||
169 | return err; | 163 | return err; |
170 | } | 164 | } |
171 | 165 | ||
172 | static int cpuacct_percpu_seq_read(struct cgroup *cgroup, struct cftype *cft, | 166 | static int cpuacct_percpu_seq_read(struct cgroup_subsys_state *css, |
173 | struct seq_file *m) | 167 | struct cftype *cft, struct seq_file *m) |
174 | { | 168 | { |
175 | struct cpuacct *ca = cgroup_ca(cgroup); | 169 | struct cpuacct *ca = css_ca(css); |
176 | u64 percpu; | 170 | u64 percpu; |
177 | int i; | 171 | int i; |
178 | 172 | ||
@@ -189,10 +183,10 @@ static const char * const cpuacct_stat_desc[] = { | |||
189 | [CPUACCT_STAT_SYSTEM] = "system", | 183 | [CPUACCT_STAT_SYSTEM] = "system", |
190 | }; | 184 | }; |
191 | 185 | ||
192 | static int cpuacct_stats_show(struct cgroup *cgrp, struct cftype *cft, | 186 | static int cpuacct_stats_show(struct cgroup_subsys_state *css, |
193 | struct cgroup_map_cb *cb) | 187 | struct cftype *cft, struct cgroup_map_cb *cb) |
194 | { | 188 | { |
195 | struct cpuacct *ca = cgroup_ca(cgrp); | 189 | struct cpuacct *ca = css_ca(css); |
196 | int cpu; | 190 | int cpu; |
197 | s64 val = 0; | 191 | s64 val = 0; |
198 | 192 | ||