Change your CPU governor

There's a GUI application that allows you to set minimum and maximum CPU speeds, and change the CPU governor. It works for both Intel and AMD CPUs:

sudo apt install cpupower-gui

The types of CPU governors:
performance: Run the CPU at maximum frequency, obtained from /sys/devices/system/cpu/cpuX/cpufreq/scaling_max.

powersave: Run the CPU at the minimum frequency, obtained from /sys/devices/system/cpu/cpuX/cpufreq/scaling_min_freq.

userspace: Run the CPU at user specified frequencies, configurable via /sys/devices/system/cpu/cpuX/cpufreq/scaling_setspeed. Some systems don't support this, so it defaults to the ondemand governor if the governor is set to this (my AMD Ryzen CPU, for one example).

ondemand: The default governor. Scales the frequency dynamically according to current load. Jumps to the highest frequency and then backs off as the idle time increases.

conservative: Scales the frequency dynamically according to current load. Scales the frequency more gradually than ondemand.

schedutil: Scheduler-driven CPU frequency selection.

You can alter the load at which the CPU switches to a higher frequency... for instance, when using the ondemand CPU governor (the default governor), I noticed that it's rather frenetic in switching to higher frequencies, even when the computer isn't being used and the CPU is idle.

The default value for my /sys/devices/system/cpu/cpufreq/ondemand/up_threshold file is 95. I changed it to 99.

Start cpupower-gui and set the governor for all CPUs to ondemand.
sudo su

echo -n 99 > /sys/devices/system/cpu/cpufreq/ondemand/up_threshold

Or, you can do the same for the conservative governor, which has a default value for /sys/devices/system/cpu/cpufreq/conservative/up_threshold of 80, and for /sys/devices/system/cpu/cpufreq/conservative/down_threshold of 20:

Start cpupower-gui and set the governor for all CPUs to conservative.
sudo su

echo -n 99 > /sys/devices/system/cpu/cpufreq/conservative/up_threshold

echo -n 95 > /sys/devices/system/cpu/cpufreq/conservative/down_threshold

That's what I'm using now. The CPU stays at or near its lowest frequency when the computer isn't being used, but scales up in frequency when it is being used.

Now, the above doesn't stick between reboots... but we don't have to create a service that runs at boot to set the CPU governor each time...
there's already a service we can install that'll do that.

sudo apt install cpufrequtils

echo 'GOVERNOR="conservative"' | sudo tee /etc/default/cpufrequtils

sudo systemctl disable ondemand

Why? Because as the computer boots, it uses the performance CPU governor, waits 1 minute, then switches to the ondemand governor. If it cannot switch to the ondemand governor, it attempts to change to the Schedutil governor, unless something sets it to something else... that something is cpufrequtils.

"But the
echo -n 99 > /sys/devices/system/cpu/cpufreq/conservative/up_threshold

echo -n 95 > /sys/devices/system/cpu/cpufreq/conservative/down_threshold
settings aren't maintained between reboots!", some quick-eyed individual will note.

Yes, you're right. For that, the simplest solution is to set the relevant settings at startup.

Zorin menu > System Tools > Startup Applications

Add the following:
Name: Set CPU down_threshold
Command: sudo sh -c "echo 95 > /sys/devices/system/cpu/cpufreq/conservative/down_threshold"

Name: Set CPU freq_step
Command: sudo sh -c "echo 1 > /sys/devices/system/cpu/cpufreq/conservative/freq_step"

Name: Set CPU ignore_nice_load
Command: sudo sh -c "echo 1 > /sys/devices/system/cpu/cpufreq/conservative/ignore_nice_load"

Name: Set CPU up_threshold
Command: sudo sh -c "echo 99 > /sys/devices/system/cpu/cpufreq/conservative/up_threshold"

1 Like

What the different between "cpupower-gui" compare with gnome-extension CPU manager like "CPU Power Manager" ?
For me, for quick switch between CPU Mode, prefer using gnome-extension, it easy to access via panel.

I don't think there's any difference except the layout of the applications. Both set the same settings. I prefer doing it the way I wrote of above because it sets the conservative governor after the kernel switches away from the performance governor for bootup, then after the desktop shows, it sets the CPU up_threshold, down_threshold, freq_step and ignore_nice_load.

Before doing the above, my CPU idled at 99 F. Now it idles at 86 F.

up_threshold is at what load the CPU will increase frequency. Likewise, down_threshold is at what load the CPU will decrease frequency.

freq_step just sets by how much the frequency will increase or decrease with each step, as a percentage of your maximum CPU speed.

ignore_nice_load just means that if you've got a background process that's running at low priority and you don't care how long it takes to complete (or if it's a process that always runs and never completes), you can prevent that process from bumping up your CPU frequency.

For instance, in Zorin menu > System Tools > Startup Applications, I start conky like this:
nice /usr/bin/conky -p 5 19

That starts conky at boot with a 5 second delay, and sets its niceness to 19 (lowest priority). Now even though conky is running, it doesn't cause CPU frequency to increase.


Very nice and complete explanation there, thanks bro for sharing your knowledge.
Now I knew what exactly you're doing and needed with cpupower-gui, and perhaps some time when I needed too, I know how to configure and used it.

I've learned a lot from this original post! This was a great read! But now I'm thinking 'why are CPUs wasting so much power'. Read on to see what I mean via my test:

  • I play a 4k YouTube video and enable stats to ensure there's no dropped frames during this test.
  • I view my temperatures (as a basic indication of power usage).
  • I see I'm averaging 75C
  • I then change the Power Goverernor from 'Ondemand' to 'Power Save' and the temperate goes down to 60C while the CPU speed goes down from 3.2Ghz to 1.4Ghz.

I'm aiming to understand a bit about how CPU's work here. Why isn't my computer smart enough to just jump right down to 1.4Ghz right away if there's no performance difference in this use-case scenario? Why does it need to be in a 'powersave' mode to make a big power saving (and temperature saving) to stream a YouTube video without any performance penalties that I could observe here?

FYI - I'm using a Ryzen 5700g CPU in a desktop.

The ondemand CPU governor by default jumps to maximum speed on the tiniest load, then slows down once that load goes away, so it tends to jump up to maximum speed quite often.

That makes the computer more responsive by a little bit, but not by much if you've got your CPU governor set to conservative and you've got freq_step set up so it increases CPU frequency by 10% per step. Then you can increase your up_threshold and down_threshold so the CPU really only hits maximum frequency when there's a heavy load on it.

Try 50 for down_threshold and 75 for up_threshold, with freq_step at 10. If you need the computer to be a bit more responsive, lower the down_threshold and up_threshold.


Wow, that's 167 F! That's pretty hot. Have you cleaned your air passages and fanwheel lately? If not, you should. A good vacuuming will clean things out. Just don't over-rev your fan when pulling air across it via the vacuum, that can ruin your fan bearings. If you have dust stuck in your heatpipe's cooling fins or on the fan blades, get a pipe cleaner.

On the conservative governor, with up_threshold at 75, down_threshold at 50 and freq_step at 10, while playing a 60 fps 4K YouTube video, I'm getting 48.88 C (120 F) (AMD Ryzen 5 5625 U CPU).

Also, why only 3.2 GHz? Your CPU can boost up to 4.6 GHz (base clock of 3.8 GHz). If you've never seen it do that, investigate to figure out how to enable boost. But you'll have to be sure to keep your air passages clean.


thanks so much for the advice!

I'm running in a super small case called the "METALFISH MetalGear Plus Aluminum" so it's needing to run hotter than usual with this hardware setup. I need to get around to undervolting via BIOS to really make some power savings - that will help along with your guide here!

I once bought a silent 200 CFM bathroom exhaust fan (it was a square metal box with a squirrel cage blower in it), bolted a couple stacked round car intake air cleaners to its air intake, then routed 4" flexible metal ducting to the back of the gigantic case (think about the size of a small refrigerator) to keep things cool, since I was running everything overclocked with huge heatpipe heatsinks.

Case looked like this:

Yes, it had wheels. :smile:

The advantage of that is that the case stayed dust-free. I had that computer for three years before I sold it to a co-worker, and it was as clean inside the day that I sold it as it was the day that I bought it. I sold it because it sucked ~480 watts at idle. It'd heat up the entire house under full load. It had a 1800 W power supply.

Yes, you can undervolt and still get the same performance if you've got a good chip, and that'll drop temps quite a bit. Actually, because your CPU isn't bumping up against thermal limits as much, you can actually get better performance, since the CPU frequency can stay higher for longer.

The entire bottom of that case is slotted metal... you could do a lot with that if you had a squirrel cage blower pushing air in from underneath.

You could turn it into a hovercraft and dispense with the cabinet wheels, if you could reverse the thrust downwards :rofl:

Can you still buy pipe cleaners? I have not seen a pipe smoker in years.

1 Like