Changing CPU Frequency Governor on Linux

Post Reply
GiGaBiTe
Site Admin
Posts: 49
Joined: Wed Jan 29, 2020 2:38 am

Changing CPU Frequency Governor on Linux

Post by GiGaBiTe »

To change the CPU frequency scaling governor on most Linux distributions, use this command in a terminal window, or on the command line if no X server is installed

Code: Select all

echo governor | tee /sys/devices/system/cpu/cpu*/cpufreq/scaling_governor
In the place of "governor", there are several choices, depending on what performance setting you want your CPU to run at. Here is a list of common governors, but note that not all governors are available on every CPU or every Linux distribution.

Code: Select all

conservative
ondemand
userspace
powersave
performance
schedutil
Note that this will set the governor on all CPU cores present in the system. If you want to change individual cores to different governors, change the "cpu*" to whichever CPU core/thread you want to be something else. If your CPU has hyperthreading, make sure the governor is set the same for all threads on the CPU core they reside on, or you may run into problems.

An example would be an i7-3770k has 4 cores and 8 threads. In Linux, this would appear as CPU0-CPU7.
CPU 0-1 would be Core 0
CPU 2-3 would be Core 1
CPU 4-5 would be Core 2
CPU 6-7 would be Core 3

0-1, 2-3, 4-5 and 6-7 would all need to be set in pairs to the same governor.
GiGaBiTe
Site Admin
Posts: 49
Joined: Wed Jan 29, 2020 2:38 am

Re: Changing CPU Frequency Governor on Linux

Post by GiGaBiTe »

As an addendum, there's one more method of changing the governor using the "cpu-power" utility.

Different distributions have this utility in different packages. On Fedora, it's in the kernel-utilities package.

You can change the governor using the following command:

Code: Select all

cpu-power frequency-set -g governor
Replace "governor" with the desired governor you want to use.
Post Reply