How I can disable CPU frequency scaling and set the system to performance?

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:

  • https://wiki.debian.org/HowTo/CpuFrequencyScaling
  • Disable "ondemand" CPU scaling daemon

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.


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