Changing CPU Scaling Governor on Linux

Through “Scaling Governor”, you can choose the optimal CPU frequency control scheme, which affects power consumption and performance.

On highly loaded access servers, acquaintances had cases of server hangup during “ondemand”, although I did not have such cases, but still I recommend changing it to “performance”.
On laptops and lightly loaded servers, you can leave “ondemand” to save energy.

Let’s see the current value of all processor cores:

cat /sys/devices/system/cpu/cpu*/cpufreq/scaling_governor
ls /sys/devices/system/cpu/

In my case, the default value for all eight cores is “ondemand”.

Let’s look at possible schemes:

cat /sys/devices/system/cpu/cpu0/cpufreq/scaling_available_governors

Switch to root user:

sudo su

And we indicate for all kernels “performance”:

echo performance > /sys/devices/system/cpu/cpu0/cpufreq/scaling_governor
echo performance > /sys/devices/system/cpu/cpu1/cpufreq/scaling_governor
echo performance > /sys/devices/system/cpu/cpu2/cpufreq/scaling_governor
echo performance > /sys/devices/system/cpu/cpu3/cpufreq/scaling_governor
echo performance > /sys/devices/system/cpu/cpu4/cpufreq/scaling_governor
echo performance > /sys/devices/system/cpu/cpu5/cpufreq/scaling_governor
echo performance > /sys/devices/system/cpu/cpu6/cpufreq/scaling_governor
echo performance > /sys/devices/system/cpu/cpu7/cpufreq/scaling_governor

Check:

cat /sys/devices/system/cpu/cpu*/cpufreq/scaling_governor
egrep '(MHz)' /proc/cpuinfo

See also my article:
Changing the processor core frequency in Linux

Did my article help you? How about buying me a cup of coffee as an encouragement? Buy me a coffe.

Leave a comment

Leave a Reply