change min and max cpu frequency

26,752

Solution 1

Edit May 13, 2019 - simple bash GUI script

I wrote this simple bash GUI script to change minimum and maximum frequencies:

cpuf.png


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

Solution 2

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

Share:
26,752

Related videos on Youtube

Kemzen
Author by

Kemzen

Updated on September 18, 2022

Comments

  • Kemzen
    Kemzen over 1 year

    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
    
    • jones0610
      jones0610 almost 6 years
      Are you asking about overclocking the CPU? If so, that is done in the BIOS.
    • WinEunuuchs2Unix
      WinEunuuchs2Unix almost 6 years
      I've posted a preliminary answer on how to discover your frequencies. Update your question with your results and specify how you would like them changed. Then I'll update my answer with the new values and commands. Thanks.
    • WinEunuuchs2Unix
      WinEunuuchs2Unix almost 6 years
      I've changed the commands to enter in my answer. This will eliminate the error message you are getting for the current frequency. Please update your question with new commands.
    • WinEunuuchs2Unix
      WinEunuuchs2Unix almost 6 years
      I can see your CPUs are running at full speed. There might be other problems.
    • Kemzen
      Kemzen almost 6 years
      @WinEunuuchs2Unix I have monitored my CPU and it jumps between min and max values. My CPU usage is roughly about 30% when I'm using my computer, and almost never over 50%. So I should be able to lower max frequency about half to make it cooler and quieter. And I dont care if computer becomes slower.
    • WinEunuuchs2Unix
      WinEunuuchs2Unix almost 6 years
      @Kemzen I've added a new section to my answer on how to reset max freq to 1700 MHz.
  • Kemzen
    Kemzen almost 6 years
    I do not want to disable Power saving features. I want to set Max CPU frequency to 1.7 GHz in OS.
  • Kemzen
    Kemzen almost 6 years
    It works, thank you very much. A short explanation of the command would be beautiful too. Anyway, thanks again.
  • WinEunuuchs2Unix
    WinEunuuchs2Unix almost 6 years
    @Kemzen Glad it works. Can you click the grey check mark next to the answer to let others know it works? For more explanation please read this: askubuntu.com/questions/340626/…
  • Olegzandr Denman
    Olegzandr Denman about 4 years
    how do we install cpuf man?
  • WinEunuuchs2Unix
    WinEunuuchs2Unix about 4 years
    @OlegzandrDenman click on the underlined link. If you have a question ask it there.
  • Delestro
    Delestro about 4 years
    Thank you so much for this answer! I installed their gnome extension (extensions.gnome.org/extension/1082/cpufreq) and now I can really easily control the number of active cores. My laptop temperature and fan activity came down to bearable levels again! And if I need some extra power it's easy to pump up the number of active cores.
  • Bram
    Bram over 3 years
    Can you write values to scaling_min_freq that are lower than cpuinfo_min_freq? My Xeon is set to 1.2GHz for min_freq, and still uses 45W at mains, when idle. I need that to be lower, because my motherboard does not have suspend-to-ram.
  • WinEunuuchs2Unix
    WinEunuuchs2Unix over 3 years
    @Bram I don't really tinker at that level but I believe you can under clock the CPU which means undervolting it which means less wattage. (at least I think so). A better question to ask is how to suspend your system when it's inactive...