diff options
| author | Tejun Heo <tj@kernel.org> | 2013-12-05 12:28:01 -0500 |
|---|---|---|
| committer | Tejun Heo <tj@kernel.org> | 2013-12-05 12:28:01 -0500 |
| commit | 44ffc75ba9a63f972dbebd4fab6888db5fcd3b0e (patch) | |
| tree | 74e59dc41c550c3013e4ed1ec651557f8acfceee /kernel/sched | |
| parent | afb2bc14e1c989cf0635bd04edb5ff55b8c1c7bd (diff) | |
cgroup, sched: convert away from cftype->read_map()
In preparation of conversion to kernfs, cgroup file handling is being
consolidated so that it can be easily mapped to the seq_file based
interface of kernfs.
cftype->read_map() doesn't add any value and being replaced with
->read_seq_string(). Update cpu_stats_show() and cpuacct_stats_show()
accordingly.
This patch doesn't make any visible behavior changes.
Signed-off-by: Tejun Heo <tj@kernel.org>
Acked-by: Li Zefan <lizefan@huawei.com>
Cc: Ingo Molnar <mingo@redhat.com>
Cc: Peter Zijlstra <peterz@infradead.org>
Diffstat (limited to 'kernel/sched')
| -rw-r--r-- | kernel/sched/core.c | 10 | ||||
| -rw-r--r-- | kernel/sched/cpuacct.c | 8 |
2 files changed, 9 insertions, 9 deletions
diff --git a/kernel/sched/core.c b/kernel/sched/core.c index c1808606ee5f..f28ec6722f0b 100644 --- a/kernel/sched/core.c +++ b/kernel/sched/core.c | |||
| @@ -7257,14 +7257,14 @@ static int __cfs_schedulable(struct task_group *tg, u64 period, u64 quota) | |||
| 7257 | } | 7257 | } |
| 7258 | 7258 | ||
| 7259 | static int cpu_stats_show(struct cgroup_subsys_state *css, struct cftype *cft, | 7259 | static int cpu_stats_show(struct cgroup_subsys_state *css, struct cftype *cft, |
| 7260 | struct cgroup_map_cb *cb) | 7260 | struct seq_file *sf) |
| 7261 | { | 7261 | { |
| 7262 | struct task_group *tg = css_tg(css); | 7262 | struct task_group *tg = css_tg(css); |
| 7263 | struct cfs_bandwidth *cfs_b = &tg->cfs_bandwidth; | 7263 | struct cfs_bandwidth *cfs_b = &tg->cfs_bandwidth; |
| 7264 | 7264 | ||
| 7265 | cb->fill(cb, "nr_periods", cfs_b->nr_periods); | 7265 | seq_printf(sf, "nr_periods %d\n", cfs_b->nr_periods); |
| 7266 | cb->fill(cb, "nr_throttled", cfs_b->nr_throttled); | 7266 | seq_printf(sf, "nr_throttled %d\n", cfs_b->nr_throttled); |
| 7267 | cb->fill(cb, "throttled_time", cfs_b->throttled_time); | 7267 | seq_printf(sf, "throttled_time %llu\n", cfs_b->throttled_time); |
| 7268 | 7268 | ||
| 7269 | return 0; | 7269 | return 0; |
| 7270 | } | 7270 | } |
| @@ -7318,7 +7318,7 @@ static struct cftype cpu_files[] = { | |||
| 7318 | }, | 7318 | }, |
| 7319 | { | 7319 | { |
| 7320 | .name = "stat", | 7320 | .name = "stat", |
| 7321 | .read_map = cpu_stats_show, | 7321 | .read_seq_string = cpu_stats_show, |
| 7322 | }, | 7322 | }, |
| 7323 | #endif | 7323 | #endif |
| 7324 | #ifdef CONFIG_RT_GROUP_SCHED | 7324 | #ifdef CONFIG_RT_GROUP_SCHED |
diff --git a/kernel/sched/cpuacct.c b/kernel/sched/cpuacct.c index f64722ff0299..dd88738cd4a9 100644 --- a/kernel/sched/cpuacct.c +++ b/kernel/sched/cpuacct.c | |||
| @@ -184,7 +184,7 @@ static const char * const cpuacct_stat_desc[] = { | |||
| 184 | }; | 184 | }; |
| 185 | 185 | ||
| 186 | static int cpuacct_stats_show(struct cgroup_subsys_state *css, | 186 | static int cpuacct_stats_show(struct cgroup_subsys_state *css, |
| 187 | struct cftype *cft, struct cgroup_map_cb *cb) | 187 | struct cftype *cft, struct seq_file *sf) |
| 188 | { | 188 | { |
| 189 | struct cpuacct *ca = css_ca(css); | 189 | struct cpuacct *ca = css_ca(css); |
| 190 | int cpu; | 190 | int cpu; |
| @@ -196,7 +196,7 @@ static int cpuacct_stats_show(struct cgroup_subsys_state *css, | |||
| 196 | val += kcpustat->cpustat[CPUTIME_NICE]; | 196 | val += kcpustat->cpustat[CPUTIME_NICE]; |
| 197 | } | 197 | } |
| 198 | val = cputime64_to_clock_t(val); | 198 | val = cputime64_to_clock_t(val); |
| 199 | cb->fill(cb, cpuacct_stat_desc[CPUACCT_STAT_USER], val); | 199 | seq_printf(sf, "%s %lld\n", cpuacct_stat_desc[CPUACCT_STAT_USER], val); |
| 200 | 200 | ||
| 201 | val = 0; | 201 | val = 0; |
| 202 | for_each_online_cpu(cpu) { | 202 | for_each_online_cpu(cpu) { |
| @@ -207,7 +207,7 @@ static int cpuacct_stats_show(struct cgroup_subsys_state *css, | |||
| 207 | } | 207 | } |
| 208 | 208 | ||
| 209 | val = cputime64_to_clock_t(val); | 209 | val = cputime64_to_clock_t(val); |
| 210 | cb->fill(cb, cpuacct_stat_desc[CPUACCT_STAT_SYSTEM], val); | 210 | seq_printf(sf, "%s %lld\n", cpuacct_stat_desc[CPUACCT_STAT_SYSTEM], val); |
| 211 | 211 | ||
| 212 | return 0; | 212 | return 0; |
| 213 | } | 213 | } |
| @@ -224,7 +224,7 @@ static struct cftype files[] = { | |||
| 224 | }, | 224 | }, |
| 225 | { | 225 | { |
| 226 | .name = "stat", | 226 | .name = "stat", |
| 227 | .read_map = cpuacct_stats_show, | 227 | .read_seq_string = cpuacct_stats_show, |
| 228 | }, | 228 | }, |
| 229 | { } /* terminate */ | 229 | { } /* terminate */ |
| 230 | }; | 230 | }; |
