Skip to main content
Added RegEx to the last command in order to change the frequency of all CPUs
Source Link

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's systemd 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 teeprevious 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.

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's systemd 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. Do the same for every CPU in your machine. You can append their path to the tee command, like

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/cpu1/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 present in the system, regardless of the number of cores, I would highly appreciate it.

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's systemd 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. To do the same for every CPU in your machine, just change the previous command to

SUBSYSTEM=="module", ACTION=="add", KERNEL=="acpi_cpufreq", RUN+="/bin/sh -c 'echo 2000000 | tee /sys/devices/system/cpu/cpu*[0-9]/cpufreq/scaling_max_freq'"

and this will change the maximum frequency for every CPU in your system.

Source Link

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's systemd 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. Do the same for every CPU in your machine. You can append their path to the tee command, like

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/cpu1/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 present in the system, regardless of the number of cores, I would highly appreciate it.