On 2021-04-05, Henrik Carlqvist <
Henrik.C...@deadspam.com> wrote:
> On Sat, 03 Apr 2021 23:00:16 +0000, me wrote:
>> Powertop says the system is using about 15W on battery giving about 3.5
>> hours batt life, not bad for a 5-year old battery. I might be able to
>> tune power down a little.
>
> I call the following custom script from rc.local on Slackware 14.2:
>
> cat /usr/local/etc/rc.d/rc.cpufreq
>
> #!/bin/sh
>
> # Fix cpu frequency adaption to load
> /sbin/modprobe acpi-cpufreq 2>/dev/null && \
> /sbin/modprobe cpufreq_ondemand && \
> find /sys/devices/system/cpu -name scaling_governor -exec \
> sh -c 'echo ondemand > {}' \; && \
> echo CPU frequency will be adapted to load || \
> echo No CPU frequency adaption on this machine...
>
> echo 1 > /sys/devices/system/cpujk/cpufreq/ondemand/ignore_nice_load
> echo 100 > /sys/devices/system/cpu/cpufreq/ondemand/sampling_down_factor
> echo 50 > /sys/devices/system/cpu/cpufreq/ondemand/up_threshold
>
>
>
> The above script is not specific for laptops, I also use it for desktops
> and servers. Without load or only nice loads cores will run at minimum
> supported frequencies and when working the frequencies (and power
> consumption) will be maximized. It is easy to check that the settings
> work by doing:
>
> cat /proc/cpuinfo | grep MHz
> cpu MHz : 800.000
> cpu MHz : 800.000
> cpu MHz : 1200.000
> cpu MHz : 3801.000
> cpu MHz : 800.000
> cpu MHz : 3801.000
> cpu MHz : 800.000
> cpu MHz : 800.000
>
> regards Henrik
Hi Henrik, thanks for your script. It appears that slackware-current is
already setup to use the ondemand scaling governor (at least, in the
recent image that I downloaded!), however I found the
sampling_down_threshold is set to 1 (instead of your value of 100) and
the up_threshold is set to 95 (instead of 50) by default. I have tried
running some loads and watching the cpu frequencies reported by
/proc/cpuinfo, and they correctly scale up to the max under load and
drop back down when idle; and each core is scaled individually.
So it would appear that slackware-current has implemented something
similar to your script by default.