the macro CPU_INFO_FOREACH loop over every CPU but the frequency
algorithm will raise frequency if one cpu usage goes over a threshold
but also if the sum of cpu usage goes over another threshold.

In the current case, if you have offline cpu (because of hw.smt=0), the
total will still sum all the idle cpu and it's unlikely that the total
threshold is ever reached before the per cpu one.

so, this diff skip offline cpus in the loop (robert@ gave me the big
clue to use cpu_is_online in the loop)

Index: sched_bsd.c
===================================================================
RCS file: /cvs/src/sys/kern/sched_bsd.c,v
retrieving revision 1.62
diff -u -p -r1.62 sched_bsd.c
--- sched_bsd.c 30 Jan 2020 08:51:27 -0000      1.62
+++ sched_bsd.c 28 May 2020 14:21:25 -0000
@@ -576,6 +576,8 @@ setperf_auto(void *v)
        j = 0;
        speedup = 0;
        CPU_INFO_FOREACH(cii, ci) {
+               if (!cpu_is_online(ci))
+                       continue;
                total = 0;
                for (i = 0; i < CPUSTATES; i++) {
                        total += ci->ci_schedstate.spc_cp_time[i];

Reply via email to