cgroup, sched: convert away from cftype->read_map()
authorTejun Heo <tj@kernel.org>
Thu, 5 Dec 2013 17:28:01 +0000 (12:28 -0500)
committerTejun Heo <tj@kernel.org>
Thu, 5 Dec 2013 17:28:01 +0000 (12:28 -0500)
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>
kernel/sched/core.c
kernel/sched/cpuacct.c

index c1808606ee5f0f4e48e2fc51380369ba248bd9fe..f28ec6722f0bd37269914fad088b85b055f99313 100644 (file)
@@ -7257,14 +7257,14 @@ static int __cfs_schedulable(struct task_group *tg, u64 period, u64 quota)
 }
 
 static int cpu_stats_show(struct cgroup_subsys_state *css, struct cftype *cft,
-               struct cgroup_map_cb *cb)
+                         struct seq_file *sf)
 {
        struct task_group *tg = css_tg(css);
        struct cfs_bandwidth *cfs_b = &tg->cfs_bandwidth;
 
-       cb->fill(cb, "nr_periods", cfs_b->nr_periods);
-       cb->fill(cb, "nr_throttled", cfs_b->nr_throttled);
-       cb->fill(cb, "throttled_time", cfs_b->throttled_time);
+       seq_printf(sf, "nr_periods %d\n", cfs_b->nr_periods);
+       seq_printf(sf, "nr_throttled %d\n", cfs_b->nr_throttled);
+       seq_printf(sf, "throttled_time %llu\n", cfs_b->throttled_time);
 
        return 0;
 }
@@ -7318,7 +7318,7 @@ static struct cftype cpu_files[] = {
        },
        {
                .name = "stat",
-               .read_map = cpu_stats_show,
+               .read_seq_string = cpu_stats_show,
        },
 #endif
 #ifdef CONFIG_RT_GROUP_SCHED
index f64722ff029907b1cbcc6ed57cbc8c1f2b013534..dd88738cd4a9dd93c1d465326a0a2553fabc8db2 100644 (file)
@@ -184,7 +184,7 @@ static const char * const cpuacct_stat_desc[] = {
 };
 
 static int cpuacct_stats_show(struct cgroup_subsys_state *css,
-                             struct cftype *cft, struct cgroup_map_cb *cb)
+                             struct cftype *cft, struct seq_file *sf)
 {
        struct cpuacct *ca = css_ca(css);
        int cpu;
@@ -196,7 +196,7 @@ static int cpuacct_stats_show(struct cgroup_subsys_state *css,
                val += kcpustat->cpustat[CPUTIME_NICE];
        }
        val = cputime64_to_clock_t(val);
-       cb->fill(cb, cpuacct_stat_desc[CPUACCT_STAT_USER], val);
+       seq_printf(sf, "%s %lld\n", cpuacct_stat_desc[CPUACCT_STAT_USER], val);
 
        val = 0;
        for_each_online_cpu(cpu) {
@@ -207,7 +207,7 @@ static int cpuacct_stats_show(struct cgroup_subsys_state *css,
        }
 
        val = cputime64_to_clock_t(val);
-       cb->fill(cb, cpuacct_stat_desc[CPUACCT_STAT_SYSTEM], val);
+       seq_printf(sf, "%s %lld\n", cpuacct_stat_desc[CPUACCT_STAT_SYSTEM], val);
 
        return 0;
 }
@@ -224,7 +224,7 @@ static struct cftype files[] = {
        },
        {
                .name = "stat",
-               .read_map = cpuacct_stats_show,
+               .read_seq_string = cpuacct_stats_show,
        },
        { }     /* terminate */
 };