Messages in this thread Patch in this message | | | Subject | [PATCH 3/4] sched: Export per task_cgroup nr_iowait to userspace | From | Kirill Tkhai <> | Date | Mon, 06 Nov 2017 17:40:41 +0300 |
| |
Make "stat" file always exist in cpu cgroup directory (not only in CONFIG_CFS_BANDWIDTH case), and show task_cgroup's nr_iowait there.
This may be useful for containers to check a statistics of a single container.
Signed-off-by: Kirill Tkhai <ktkhai@virtuozzo.com> --- kernel/sched/core.c | 19 +++++++++++++------ 1 file changed, 13 insertions(+), 6 deletions(-)
diff --git a/kernel/sched/core.c b/kernel/sched/core.c index 86d1ad5f49bd..1b54707f5344 100644 --- a/kernel/sched/core.c +++ b/kernel/sched/core.c @@ -6665,20 +6665,27 @@ static int __cfs_schedulable(struct task_group *tg, u64 period, u64 quota) return ret; } +#endif /* CONFIG_CFS_BANDWIDTH */ +#endif /* CONFIG_FAIR_GROUP_SCHED */ static int cpu_stats_show(struct seq_file *sf, void *v) { struct task_group *tg = css_tg(seq_css(sf)); + int i, nr_iowait = 0; +#ifdef CONFIG_CFS_BANDWIDTH struct cfs_bandwidth *cfs_b = &tg->cfs_bandwidth; 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); +#endif + for_each_possible_cpu(i) { + nr_iowait += atomic_read(&tg->stat[i].nr_iowait); + } + seq_printf(sf, "nr_iowait %d\n", nr_iowait); return 0; } -#endif /* CONFIG_CFS_BANDWIDTH */ -#endif /* CONFIG_FAIR_GROUP_SCHED */ #ifdef CONFIG_RT_GROUP_SCHED static int cpu_rt_runtime_write(struct cgroup_subsys_state *css, @@ -6707,6 +6714,10 @@ static u64 cpu_rt_period_read_uint(struct cgroup_subsys_state *css, #endif /* CONFIG_RT_GROUP_SCHED */ static struct cftype cpu_files[] = { + { + .name = "stat", + .seq_show = cpu_stats_show, + }, #ifdef CONFIG_FAIR_GROUP_SCHED { .name = "shares", @@ -6725,10 +6736,6 @@ static struct cftype cpu_files[] = { .read_u64 = cpu_cfs_period_read_u64, .write_u64 = cpu_cfs_period_write_u64, }, - { - .name = "stat", - .seq_show = cpu_stats_show, - }, #endif #ifdef CONFIG_RT_GROUP_SCHED {
| |