48

My processor is running at 40% of its maximum speed, I want it to use 100% of the speed, all the time. I searched on Google but the tutorials are very old and they all differ.

So, how can I permanently disable CPU frequency scaling and set my system to performance mode?

Please, only terminal based solutions, I don't want applets.

I'm using Xubuntu 14.04 x64.

Removed
  • 3,698

6 Answers6

66

After struggling with ondemand for a while, I will share how to permanently disable it in Ubuntu and its derivates.

Install cpufrequtils:

sudo apt-get install cpufrequtils

Then edit the following file (if it doesn't exist, create it):

sudo nano /etc/default/cpufrequtils

And add the following line to it:

GOVERNOR="performance"

Save and exit.

Now you need to disable ondemand daemon, otherwise after you reboot the settings will be overwritten.

sudo update-rc.d ondemand disable

And you are done!

You can check your settings with:

cpufreq-info

It will show a block of information for every core your processor has. Just check if all of then are in performance mode, and at the maximum speed of your processor.

Update:

The Debian Wiki says that sysfsutils is necessary in order to maintain the settings across reboots, but that is untrue. Also, enabling sysfsutils make my system unstable, so it's not recommended.

Sorry if I misspelled something. :)

Sources:

Removed
  • 3,698
  • 2
    /etc/default/cpufrequtils/ doesn't exist on my Ubuntu 14.04, it seems that the correct path is /etc/init.d/cpufrequtils – RubenLaguna Apr 24 '15 at 13:57
  • 1
    I did this with my server but I'm wondering if I should disable it after doing what I needed to do. Is this going to kill my server in the long run? – David 天宇 Wong May 07 '15 at 20:13
  • 4
    @ecerulm: /etc/default/cpufrequtils/ is sourced in /etc/init.d/cpufrequtils so it works just as well, and it is easier to maintain your own settings over package updates if configured in /etc/default/cpufrequtils/. – Jérôme Jul 15 '15 at 21:31
  • 3
    Actually, on my 3.19.0-51-generic ubuntu server "performance" is default overridden by /etc/init.d/ondemand Thus, reboot after sudo update-rc.d ondemand disable is all I needed. – wick Mar 05 '16 at 19:24
  • My A8-4500M still throttles although the temperature is below 80C since I undervolted it – Suici Doga Jul 18 '16 at 01:20
  • I followed these steps in Ubuntu Server 14, but cpufreq-info still shows that some of my cores are downclocked. Could it be that some hardware override is preventing this from working? – sudo Jul 07 '17 at 16:32
  • If you disable the ondemand governor (with update-rc.d) does that mean you can't later switch to it with cpufreq-set even temporarily? And how did sysfsutils cause unstability, is there a Ubuntu bug about it? – Xen2050 Dec 22 '17 at 23:06
  • 3
    FYI, for newer OS versions replace the sudo update-rc.d ondemand disable command with sudo systemctl disable ondemand – The Thirsty Ape Dec 08 '20 at 22:24
24

I cannot comment, so I had to resort to a new answer. For immediate results, make sure you do sudo /etc/init.d/cpufrequtils restart for the new frequency to kick in after you follow all of Dennie's steps.

Juanpi
  • 350
11

Try this:

gksu gedit /sys/devices/system/cpu/cpu0/cpufreq/scaling_governor

Replace ondemand with performance. Repeat for every core (increase cpu0: cpu1, cpu2).

If you get save errors, use nano editor:

sudo nano /sys/devices/system/cpu/cpu0/cpufreq/scaling_governor

Source: Avoiding CPU Speed Scaling – Running CPU At Full Speed

Cornelius
  • 9,483
  • 4
  • 40
  • 62
  • I stumbled with this site earlier, I cannot save the file, both mousepad and nano gives me errors. – Removed Sep 13 '14 at 19:10
  • @Dennis gedit gave errors to me too, but the file got saved despite the errors. Close the editor and open it again to see if it is saved. – Cornelius Sep 13 '14 at 19:12
  • You are right, it was indeed saved. But when I reboot the computer it goes back to ondemand. – Removed Sep 13 '14 at 19:25
  • @Dennis indeed, the same issue addressed here, but no answer... – Cornelius Sep 13 '14 at 19:27
  • I managed to set system to performance, and use 100% of the clock speed, following this Debian wiki: https://wiki.debian.org/HowTo/CpuFrequencyScaling. However I stumbled in another issue. When I reboot the PC, after a minute or two, the system goes back to ondemand and my clock speeds drops again. Something is overwriting the settings. – Removed Sep 13 '14 at 20:23
  • 1
    I found the solution, you need to disable the ondemand daemon, with: sudo update-rc.d ondemand disable (http://askubuntu.com/questions/3924/disable-ondemand-cpu-scaling-daemon) – Removed Sep 13 '14 at 20:51
3

After having installed cpufrequtils by sudo apt-get install cpufrequtils , look at the info given by the command cpufreq-info, then create a file - sudo nano /etc/default/cpufrequtils - and write into it as examplified in picture below. In your case max and min would be the same value.

GOVERNOR="ondemand"
MIN_SPEED="800MHz"
MAX_SPEED="950MHz"

Lastly the command to make the change take action and be permanent (except when booting up, that is) sudo /etc/init.d/cpufrequtils restart , resulting in this output from cpufreq-info:

peter@peter-HP-Compaq-2510p:~$ cpufreq-info
cpufrequtils 008: cpufreq-info (C) Dominik Brodowski 2004-2009
Report errors and bugs to cpufreq@vger.kernel.org, please.
analyzing CPU 0:
  driver: acpi-cpufreq
  CPUs which run at the same hardware frequency: 0
  CPUs which need to have their frequency coordinated by software: 0
  maximum transition latency: 10.0 us.
  hardware limits: 800 MHz - 1.20 GHz
  available frequency steps: 1.20 GHz, 1.07 GHz, 933 MHz, 800 MHz
  available cpufreq governors: conservative, ondemand, userspace,  powersave, performance
  current policy: frequency should be within 800 MHz and 950 MHz.
                  The governor "ondemand" may decide which speed to use
                  within this range.
  current CPU frequency is 933 MHz.
  cpufreq stats: 1.20 GHz:1,27%, 1.07 GHz:0,01%, 933 MHz:95,97%, 800  MHz:2,75%  (5975)
analyzing CPU 1:
  driver: acpi-cpufreq
  CPUs which run at the same hardware frequency: 1
  CPUs which need to have their frequency coordinated by software: 1
  maximum transition latency: 10.0 us.
  hardware limits: 800 MHz - 1.20 GHz
  available frequency steps: 1.20 GHz, 1.07 GHz, 933 MHz, 800 MHz
  available cpufreq governors: conservative, ondemand, userspace,  powersave, performance
  current policy: frequency should be within 800 MHz and 950 MHz.
                  The governor "ondemand" may decide which speed to use
                  within this range.
  current CPU frequency is 800 MHz.
  cpufreq stats: 1.20 GHz:1,26%, 1.07 GHz:0,01%, 933 MHz:95,83%, 800  MHz:2,90%  (7039)
peter@peter-HP-Compaq-2510p:~$ 

This works for me on Xubuntu 18.04.2

Fabby
  • 34,259
  • 1
    Welcome to Ask Ubuntu. :-) Can you please [edit] your answer, remove the pictures and replace them with text indented by 4 spaces, please? Then leave a comment @Fabby and I'll turn the downvote into an upvote. (Why? Because pictures are not searchable by Google...) – Fabby Apr 27 '19 at 21:31
  • @ Fabby The question now also supplies the examples in texted version! I can understand the purpose. However, for readability on my screen, it is better with pictures as I then don't have to side-scroll in the text. Don't have widescreen, which might solve that problem? – PeterEriksson Apr 28 '19 at 09:47
  • My apologies: tt's much clearer like this... (not as beautiful, but much more functional.) if you insist on having pictures in there, please feel free to roll back to the previous version and I'll even leave the upvote standing, but it's just not the way we do things here: text is text and GUI = screenshot! ;-) – Fabby Apr 28 '19 at 09:54
0

I have a Dell Precision 5510 and it was permanently set to run at 800Mhz no matter what kernel CPU governor/freq settings I changed. I ended up having to take the back off, disconnect the battery, boot up with AC power, shut down, reconnect the battery, then put the back on. This reset something internal to the hardware and allowed my Dell to run at 3.6Ghz again.

galatians
  • 474
0

On the recent kernels, with Intel hardware, the frequency driver still has some flexibility, even if you set the governor to userspace.

You can turn it off completely (temporarily) by

echo off > /sys/devices/system/cpu/intel_pstate/status