How to Limit CPU Frequency on Fedora

🗄️ Please note: This is an older post - the info might be obsolete, but the approach still works for mentioned Fedora version.

If you, just like me, want to limit your laptop’s CPU with Fedora Linux, this small how-to is what you need. What is it for? Well, there’s a number of reasons. After limiting CPU frequency I got:

  • Better thermal mode
  • Decreasing fan noise level
  • Increasing battery life

So let’s start

First thing first - we have to install cpupower package. In Fedora (for this post I used Fedora 28) you can just do

sudo dnf install kernel-tools

Next let’s check what governons are available:

cpupower frequency-info --governors

If the output is something like this:

analyzing CPU 0:
  available cpufreq governors: powersave performance

then we have to do some magic with intel pstate driver. As you can see in the documentation, this driver provides an interface to control the P-State selection for the SandyBridge+ Intel processors.

So we need to do the following:

sudo vi /etc/default/grub

And add option intel_pstate=disable to GRUB_CMDLINE_LINUX. In my case the file’s content looks like that:

GRUB_TIMEOUT=5
GRUB_DISTRIBUTOR="$(sed 's, release .*$,,g' /etc/system-release)"
GRUB_DEFAULT=saved
GRUB_DISABLE_SUBMENU=true
GRUB_TERMINAL_OUTPUT="console"
GRUB_CMDLINE_LINUX="rhgb quiet intel_pstate=disable"
GRUB_DISABLE_RECOVERY="true"

After that we need to update grub configuration and reboot.

sudo grub2-mkconfig -o /boot/grub2/grub.cfg
sudo reboot

After reboot check available governons again

cpupower frequency-info --governors
analyzing CPU 0:
  available cpufreq governors: conservative userspace powersave ondemand performance schedutil

Much better!

So now we can do anything with our CPU frequency!

Check options:

sudo cpupower --cpu all frequency-set
At least one parameter out of -f/--freq, -d/--min, -u/--max, and
-g/--governor must be passed

Try to do something like this (but remember, that numbers depend on your CPU configuration. This example is for my Lenovo X230):

sudo cpupower --cpu all frequency-set --max 2.0GHz 
sudo cpupower --cpu all frequency-info

And you should see something similar to this:

<...>
  current policy: frequency should be within 1.20 GHz and 2.00 GHz.
                  The governor "ondemand" may decide which speed to use
                  within this range.
<...>

Double check which governon is in use:

cat /sys/devices/system/cpu/cpu0/cpufreq/scaling_governor
ondemand

Well, seems good. Now you can play around with parameters to find the most suitable config for you.

That’s all. Stay tuned.

Written on May 20, 2018