change min and max cpu frequency
Is there a way to change min/max frequency for the CPU in Ubuntu 18.04 Bionic beaver? I want to lower my max CPU frequency to maybe 1700000 to make my laptop run more silent. Below is CPU frequency results.
$ paste <(cat /sys/devices/system/cpu/cpu*/cpufreq/cpuinfo_min_freq) <(sudo cat /sys/devices/system/cpu/cpu*/cpufreq/cpuinfo_cur_freq) <(cat /sys/devices/system/cpu/cpu*/cpufreq/cpuinfo_max_freq) | column -s $'\t' -t
cat: '/sys/devices/system/cpu/cpu*/cpufreq/cpuinfo_cur_freq'
800000 2194.934 2200000
800000 2194.911 2200000
800000 2194.916 2200000
800000 2194.940 2200000
Edit May 13, 2019 - simple bash GUI script
I wrote this simple bash GUI script to change minimum and maximum frequencies:
Original Answer
Discover your Min/Max/Current Frequencies
To discover your frequencies copy and paste this command into your terminal (without the $
or #
prompts):
$ sudo -i
# paste <(cat /sys/devices/system/cpu/cpu*/cpufreq/cpuinfo_min_freq) <(cat /sys/devices/system/cpu/cpu*/cpufreq/cpuinfo_cur_freq) <(cat /sys/devices/system/cpu/cpu*/cpufreq/cpuinfo_max_freq) | column -s $'\t' -t
800000 900757 3500000
800000 921781 3500000
800000 857695 3500000
800000 904921 3500000
800000 816664 3500000
800000 845203 3500000
800000 892835 3500000
800000 844187 3500000
# exit
$
The minimum frequency, current frequency and maximum frequency is listed for each CPU. In my case it is 8 CPUs, in your case it will be 4 CPUs (dual core x 2 threads per core).
Values are listed in MHz with three decimals. So CPU 0 showing:
800000 900757 3500000
- Minimum Frequency 800.000 MHz
- Current Frequency 900.757 MHz
- Maximum Frequency 3500.000 Mhz
How to reset Max Frequency
To change the maximum frequency lower (you can't change it higher) use this command to change it from 2200 Mhz to 1700 Mhz:
for x in /sys/devices/system/cpu/*/cpufreq/; do echo 1700000 | sudo tee $x/scaling_max_freq; done
I found the following project that worked for me:
https://github.com/konkor/cpufreq
It comes with a deb package for easy installation, for more info. read the installation README.md file
https://github.com/konkor/cpufreq/blob/master/INSTALL.md#releases-page