NOTE: If you want to investigate on your machine, I recommend adding the following tools.
Arch : pacman -S btop cpupower turbostat
Ubuntu / PopOS / Debian : will be updated soon 😥
It was a normal evening, I remember doing software updates on my laptop and running btop for any software suspiscious activities. I found nothing special at first then my eyes were locked on the CPU frequency which was indicating 1.4 ghz. Was it normal? I did a quick lookup on AMD’s web site. My cpu (Ryzen 4700u) comes with a base frequency of 2.0ghz and a max frequency of 4.1 ghz.
I vaguely remember using the powersave configuration, so that’s was explaining the low frequency but it was never moving either. I decided to switch governor to see if I can use my cpu to the fullest and run some benchmarks. After trying a few different governor : performance, ondemand and schedutil, I still had no luck. My CPU frequency was going up but it was maxing out at the base clock. It seemed impossible to reach any of the boost frequency advertised by the manufacturer. Time to ditch Linux? eh NO!
I checked my kernel but it was already at the latest which is 5.17 (March 2022). It should also not be the bios because I was able to max out the machine when it was running Windows.
If you run the following command it will give you some information:
From what I was seeing, my cpu doesn’t provide any boost states. If you analyze the results it also says that cpu boost is supported but not active (Active : no).
If CPU boost is supported, it’s now time to activate it!! This requires root privilege.
To enable turbo boost
cpupower frequency-set -g ondemand sudo sh -c "echo '1' > /sys/devices/system/cpu/cpufreq/boost"
To disable turbo boost
sudo sh -c "echo '1' > /sys/devices/system/cpu/cpufreq/boost"
It’s now time to test. Type the following, it should max out one core of your cpu. You can actually repeat this if you want to maximize more core. This command doesn’t need any root privileges.
dd if=/dev/zero of=/dev/null
To validate you can run btop or turbostat. Turbostat will report the actual MHZ value in the column named Bzy_MHz. The TSC frequency is the base frequency of the processor.
You can also display the frequencies without any specific tools, simply type this (CTRL-C to quit).
watch cat /sys/devices/system/cpu/cpu[0-9]*/cpufreq/scaling_cur_freq
Turbo boost is now activated! Enjoy!
Do you have to set the cpu governor? it depends. If you want to save power, I personally think you should disable the boost and use powersave. You also have a few other settings you can try : they are documented here.
Please make sure to do some testing!
My laptop is fast enough for most tasks in the powersave profile. You can create a few shell scripts and invoke them as needed
- One for your power saving
- One with schedutil or ondemand for heavier productivity
- One with performance for gaming or 3d rendering.
If you want to use the following, save them in different files, make sure you enable the execution attribute : chmod +x <script_name>
#!/bin/bash cpupower frequency-set -g powersave sudo sh -c "echo '0' > /sys/devices/system/cpu/cpufreq/boost"
#!/bin/bash cpupower frequency-set -g ondemand sudo sh -c "echo '1' > /sys/devices/system/cpu/cpufreq/boost"
#!/bin/bash cpupower frequency-set -g performance sudo sh -c "echo '1' > /sys/devices/system/cpu/cpufreq/boost"