50

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,748

7 Answers7

67

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,748
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,653
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
  • 35,017
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
  • 448
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
0

Another tool is cpupower. It must be run as root in order to change the performance governor to performance:

sudo cpupower frequency-set --governor performance

It's action can be verified by cpupower frequency-info -o proc

From https://github.com/google/benchmark/blob/main/docs/reducing_variance.md

Hari
  • 141