On 2022-05-09, Atanas Vladimirov <vl...@bsdbg.net> wrote: > Hi Guys, > > I'm running -current. > Recently I noticed (not sure when it changed) that my CPU is not > throttling anymore. The `hw.perfpolicy` is set to auto and `hw.setperf` > is always at 100%. I red that there was a change in 7.1: > > - Changed the power management sysctl(8) hw.perfpolicy to "auto" at > startup, defaulting to 100% performance with AC power connected and > using the auto algorithm when on battery. > > So, my question is how I can change that behavior so the throttling is > working again?
Currently, you can either set it manually to low speed (hw.perfpolicy=manual, hw.setperf=0), modify the kernel (e.g. with the diff below), or use obsdfreqd from packages. The latter is only in -current packages not 7.1, but it could be built from ports. Index: sched_bsd.c =================================================================== RCS file: /cvs/src/sys/kern/sched_bsd.c,v retrieving revision 1.70 diff -u -p -r1.70 sched_bsd.c --- sched_bsd.c 30 Oct 2021 23:24:48 -0000 1.70 +++ sched_bsd.c 9 May 2022 17:13:10 -0000 @@ -525,7 +525,6 @@ int perfpolicy = PERFPOL_AUTO; void setperf_auto(void *); struct timeout setperf_to = TIMEOUT_INITIALIZER(setperf_auto, NULL); -extern int hw_power; void setperf_auto(void *v) @@ -544,11 +543,6 @@ setperf_auto(void *v) if (cpu_setperf == NULL) return; - if (hw_power) { - speedup = 1; - goto faster; - } - if (!idleticks) if (!(idleticks = mallocarray(ncpusfound, sizeof(*idleticks), M_DEVBUF, M_NOWAIT | M_ZERO))) @@ -583,7 +577,6 @@ setperf_auto(void *v) downbeats = 5; if (speedup && perflevel != 100) { -faster: perflevel = 100; cpu_setperf(perflevel); } else if (!speedup && perflevel != 0 && --downbeats <= 0) {