]> git.ipfire.org Git - thirdparty/kernel/linux.git/commitdiff
sched/balancing: Remove reliance on 'enum cpu_idle_type' ordering when iterating...
authorShrikanth Hegde <sshegde@linux.ibm.com>
Fri, 8 Mar 2024 10:58:53 +0000 (11:58 +0100)
committerIngo Molnar <mingo@kernel.org>
Tue, 12 Mar 2024 10:03:40 +0000 (11:03 +0100)
show_schedstat() output breaks and doesn't print all entries
if the ordering of the definitions in 'enum cpu_idle_type' is changed,
because show_schedstat() assumes that 'CPU_IDLE' is 0.

Fix it before we change the definition order & values.

[ mingo: Added changelog. ]

Signed-off-by: Shrikanth Hegde <sshegde@linux.ibm.com>
Signed-off-by: Ingo Molnar <mingo@kernel.org>
Reviewed-by: Vincent Guittot <vincent.guittot@linaro.org>
Link: https://lore.kernel.org/r/20240308105901.1096078-3-mingo@kernel.org
kernel/sched/stats.c

index 857f837f52cbed29d5f0d7e8a80a97497498fbd0..85277953cc72beaf192d5c73ac669aed6c6e0e1e 100644 (file)
@@ -150,8 +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;
-                                       itype++) {
+                       for (itype = 0; itype < CPU_MAX_IDLE_TYPES; itype++) {
                                seq_printf(seq, " %u %u %u %u %u %u %u %u",
                                    sd->lb_count[itype],
                                    sd->lb_balanced[itype],