Re: [PATCH 2/7] sched/balancing: Change 'enum cpu_idle_type' to have more natural definitions

From: Ingo Molnar
Date: Mon Mar 04 2024 - 04:29:25 EST



* Shrikanth Hegde <sshegde@xxxxxxxxxxxxx> wrote:

> I think its all getting accounted. Just that its not being printed. With
> the below change, able to see all the three types, albeit not in right
> order as per schedstat documentation.
>
> diff --git a/kernel/sched/stats.c b/kernel/sched/stats.c
> index 857f837f52cb..f36b54bdd9fa 100644
> --- a/kernel/sched/stats.c
> +++ b/kernel/sched/stats.c
> @@ -150,7 +150,7 @@ static int show_schedstat(struct seq_file *seq, void *v)
>
> seq_printf(seq, "domain%d %*pb", dcount++,
> cpumask_pr_args(sched_domain_span(sd)));
> - for (itype = CPU_IDLE; itype < CPU_MAX_IDLE_TYPES;
> + for (itype = 0; itype < CPU_MAX_IDLE_TYPES;
> itype++) {
> seq_printf(seq, " %u %u %u %u %u %u %u %u",
> sd->lb_count[itype],

Indeed, good catch - there was an implicit reliance on CPU_IDLE's position
in the loop above that my patch didn't take into account.

Fixed.

Thanks,

Ingo