Re: [PATCH v3 2/7] sched: make struct sched_statistics independent of fair sched class

From: Peter Zijlstra
Date: Tue Aug 31 2021 - 06:15:52 EST


On Tue, Aug 24, 2021 at 11:29:41AM +0000, Yafang Shao wrote:
> diff --git a/kernel/sched/debug.c b/kernel/sched/debug.c
> index 49716228efb4..4cfee2aa1a2d 100644
> --- a/kernel/sched/debug.c
> +++ b/kernel/sched/debug.c

> @@ -442,9 +442,11 @@ static void print_cfs_group_stats(struct seq_file *m, int cpu, struct task_group
> struct sched_entity *se = tg->se[cpu];
>
> #define P(F) SEQ_printf(m, " .%-30s: %lld\n", #F, (long long)F)
> -#define P_SCHEDSTAT(F) SEQ_printf(m, " .%-30s: %lld\n", #F, (long long)schedstat_val(F))
> +#define P_SCHEDSTAT(F) SEQ_printf(m, " .%-30s: %lld\n", \
> + "se->statistics."#F, (long long)schedstat_val(tg->stats[cpu]->F))
> #define PN(F) SEQ_printf(m, " .%-30s: %lld.%06ld\n", #F, SPLIT_NS((long long)F))
> -#define PN_SCHEDSTAT(F) SEQ_printf(m, " .%-30s: %lld.%06ld\n", #F, SPLIT_NS((long long)schedstat_val(F)))
> +#define PN_SCHEDSTAT(F) SEQ_printf(m, " .%-30s: %lld.%06ld\n", \
> + "se->statistics."#F, SPLIT_NS((long long)schedstat_val(tg->stats[cpu]->F)))
>
> if (!se)
> return;

> @@ -948,8 +950,8 @@ void proc_sched_show_task(struct task_struct *p, struct pid_namespace *ns,
> "---------------------------------------------------------"
> "----------\n");
>
> -#define P_SCHEDSTAT(F) __PS(#F, schedstat_val(p->F))
> -#define PN_SCHEDSTAT(F) __PSN(#F, schedstat_val(p->F))
> +#define P_SCHEDSTAT(F) __PS("se.statistics."#F, schedstat_val(p->stats.F))
> +#define PN_SCHEDSTAT(F) __PSN("se.statistics."#F, schedstat_val(p->stats.F))
>
> PN(se.exec_start);
> PN(se.vruntime);

That's sad... can't we keep it #F, this is all SCHED_DEBUG code anyway.