The Arch Wiki page on CPU frequency scaling suggests a couple of different ways to make changes performed in cpupower
persistent.
- One of those, as you mentioned, is adding a kernel module. But there are other simpler options that should be easier. The simpler is just to enable
cpufreq
'ssystemd
service, as suggested in the Arch Wiki. Just run
sudo systemctl enable cpupower
and the service will be started every time you boot up the machine. I am not running in a machine with systemd
right now, so I cannot perform any tests.
- The second option is to add a
udev
rule. I've tested this one right now and it works perfectly. Just edit the file named/etc/udev/rules.d/50-scaling-governor.rules
or similar (create it if it does not exist) and add the following content to it:
SUBSYSTEM=="module", ACTION=="add", KERNEL=="acpi_cpufreq", RUN+="/bin/sh -c 'echo 2000000 | tee /sys/devices/system/cpu/cpu0/cpufreq/scaling_max_freq'"
This will change the maximum frequency of CPU0 to the value written. In your case, 2000000
, or 2.0 GHz. DoTo do the same for every CPU in your machine. You can append their path to, just change the tee
previous command, like to
SUBSYSTEM=="module", ACTION=="add", KERNEL=="acpi_cpufreq", RUN+="/bin/sh -c 'echo 2000000 | tee /sys/devices/system/cpu/cpu0/cpufreq/scaling_max_freq /sys/devices/system/cpu/cpu1cpu*[0-9]/cpufreq/scaling_max_freq'"
and this will change the maximum frequency in both CPU0 and CPU1.
P.S: If anybody wants to edit my answer to add regex in order to apply the changes to all CPU's presentfor every CPU in theyour system, regardless of the number of cores, I would highly appreciate it.