summaryrefslogtreecommitdiffstats
path: root/kernel/sched
diff options
context:
space:
mode:
authorTejun Heo <tj@kernel.org>2017-10-23 16:18:27 -0700
committerTejun Heo <tj@kernel.org>2017-10-26 10:56:33 -0700
commitd41bf8c9deaed1a90b18d3ffc5639d4c19f0259a (patch)
tree38573de8fb3d037a30430bd16af6806031c2036c /kernel/sched
parent0d5936344f30aba0f6ddb92b030cb6a05168efe6 (diff)
downloadlinux-d41bf8c9deaed1a90b18d3ffc5639d4c19f0259a.tar.bz2
cgroup, sched: Move basic cpu stats from cgroup.stat to cpu.stat
The basic cpu stat is currently shown with "cpu." prefix in cgroup.stat, and the same information is duplicated in cpu.stat when cpu controller is enabled. This is ugly and not very scalable as we want to expand the coverage of stat information which is always available. This patch makes cgroup core always create "cpu.stat" file and show the basic cpu stat there and calls the cpu controller to show the extra stats when enabled. This ensures that the same information isn't presented in multiple places and makes future expansion of basic stats easier. Signed-off-by: Tejun Heo <tj@kernel.org> Acked-by: Peter Zijlstra (Intel) <peterz@infradead.org>
Diffstat (limited to 'kernel/sched')
-rw-r--r--kernel/sched/core.c13
1 files changed, 4 insertions, 9 deletions
diff --git a/kernel/sched/core.c b/kernel/sched/core.c
index ad255162a830..0b3eec389552 100644
--- a/kernel/sched/core.c
+++ b/kernel/sched/core.c
@@ -6678,13 +6678,12 @@ static struct cftype cpu_legacy_files[] = {
{ } /* Terminate */
};
-static int cpu_stat_show(struct seq_file *sf, void *v)
+static int cpu_extra_stat_show(struct seq_file *sf,
+ struct cgroup_subsys_state *css)
{
- cgroup_stat_show_cputime(sf, "");
-
#ifdef CONFIG_CFS_BANDWIDTH
{
- struct task_group *tg = css_tg(seq_css(sf));
+ struct task_group *tg = css_tg(css);
struct cfs_bandwidth *cfs_b = &tg->cfs_bandwidth;
u64 throttled_usec;
@@ -6817,11 +6816,6 @@ static ssize_t cpu_max_write(struct kernfs_open_file *of,
#endif
static struct cftype cpu_files[] = {
- {
- .name = "stat",
- .flags = CFTYPE_NOT_ON_ROOT,
- .seq_show = cpu_stat_show,
- },
#ifdef CONFIG_FAIR_GROUP_SCHED
{
.name = "weight",
@@ -6852,6 +6846,7 @@ struct cgroup_subsys cpu_cgrp_subsys = {
.css_online = cpu_cgroup_css_online,
.css_released = cpu_cgroup_css_released,
.css_free = cpu_cgroup_css_free,
+ .css_extra_stat_show = cpu_extra_stat_show,
.fork = cpu_cgroup_fork,
.can_attach = cpu_cgroup_can_attach,
.attach = cpu_cgroup_attach,