Frequency scaling

How to disable frequency scaling

This guide explains an easy way to disable frequency scaling.

First thing to do is to check the number of CPUs in the system with the command:

ls /sys/devices/system/cpu/

The provided output will be something like this:

cpu0  cpu2  cpuidle       kernel_max  modalias  online    power    uevent
cpu1  cpu3  intel_pstate  microcode   offline   possible  present

and in this case the number of physical CPUs for which we can disable frequency scaling is four, namely cpu0, cpu1, cpu2 and cpu3.

With the following script executed by with the root privilege:

 for i in $(seq 0 3) ; do echo "performance" > /sys/devices/system/cpu/cpu${i}/cpufreq/scaling_governor; done

we can set the performance governator policy, which disable frequency scaling. We used $(seq 0 3) because we have 4 CPUs, from cpu0 to cpu3. In a system with 8 physical cores, the correct command would have been $(seq 0 7). Remember that the script must be re-executed each time the system is restarted.

To check that frequency scaling is effectively disabled, you can type many times the following command checking that the frequencies of your CPUs are fixed to the highest values:

cat /proc/cpuinfo