On 2022 Mar 20 (Sun) at 18:13:20 +0000 (+0000), Stuart Henderson wrote:
:On 2022/03/20 18:13, Solene Rapenne wrote:
:> I'm proposing a very simple change to the automatic policy of the CPU
:> frequency scheduler.
:>
:> Currently, every 100ms the scheduler is doing this:
:>
:> - when the CPU load exceeds the threshold, CPU frequency is set to the
:> maximum and the variable downbeats is set to 5.
:> - when the CPU load is below the threshold, downbeats is decremented, if
:> it's == 0 then the CPU load is reduced to 0
:>
:> my proposal is to change the downbeat to be adaptive to the load, instead
:> of setting it to 5 all the time, I propose to increment it with a limit
:> of 5. Instead of having the frequency set at max for 500ms (5 cycles)
:> every time the CPU usage is above the treshold, we will keep the
:> frequency high for a number of cycles depending how long it was high
:> (up to 5). So, in case of short CPU usage burst like opening a new MP3
:> file for decoding or a click on a GUI, we have a frequency burst of
:> 100ms instead of 500ms.
:>
:> I've been using it for a few days, I noticed a huge battery life
: ^^^^^^^^^^^^^^^^^
:> improvement with no responsiveness change.
: ^^^^^^^^^^^
:
:This (and the couple of complaints from people who have now seen the fan
:stay on when plugged in, when it didn't previously) suggests that mwait
:is not everything and it _would_ still make sense to still have a way to
:set automatic frequency rather than just force-high for plugged-in use
:too...
:
In some unscientific tests, my laptop cpu cools down by 20c simply
between plugged in and on battery.
imho, it's time to ressurect Cool Mode.
:>
:> Index: sched_bsd.c
:> ===================================================================
:> RCS file: /home/reposync/src/sys/kern/sched_bsd.c,v
:> retrieving revision 1.70
:> diff -u -r1.70 sched_bsd.c
:> --- sched_bsd.c 30 Oct 2021 23:24:48 -0000 1.70
:> +++ sched_bsd.c 20 Mar 2022 16:30:22 -0000
:> @@ -579,8 +579,8 @@
:> }
:> if (allidle < alltotal / 2)
:> speedup = 1;
:> - if (speedup)
:> - downbeats = 5;
:> + if (speedup && downbeats < 5)
:> + downbeats++;
:>
:> if (speedup && perflevel != 100) {
:> faster:
:>
:
--
It's illegal in Wilbur, Washington, to ride an ugly horse.