Ubuntu – How to set the CPU frequency to always stay at its maximum

cpucpufreqintel

Since I mostly use my laptop as a desktop, I'm trying to set its CPU to its maximum frequency.

The CPU is an Intel Core i5-3337U (dual-core with Hyper-Threading), which caps at 2.5GHz (with 2 active cores) and at 2.70GHz (with 1 active core) using the Intel Turbo Boost Technology.

Before starting, I tested which frequency the CPU could reach under load using LINPACK, to see if despite any active power-saving feature it could have reached the nominal maximum value of 2.5GHz; it could (measured running watch -n 1 "cat /proc/cpuinfo | grep \"cpu MHz\"").

I chose to use the cpufreq-set approach: I've installed the cpufrequtils package and at first I tried to set the CPU governor to "performance" running cpufreq-set -g performance; I can't tell whether this impacted somehow the idle frequency's range, however the result was not satisfying: in this state the frequency of all the CPUs constantly dropped down and rose up in the 1.0GHZ-2.4GHZ range.

So I tried to set the CPU governor to "userspace", in order to eventually be able to set a fixed frequency; however the following error came up:

Error setting new values. Common errors:
- Do you have proper administration rights? (super-user?)
- Is the governor you requested available and modprobed?
- Trying to set an invalid policy?
- Trying to set a specific frequency, but userspace governor is not available,
   for example because of hardware which cannot be set to a specific frequency
   or because the userspace governor isn't loaded?

After some research, I discovered that the "userpace" governor is not available when using the intel_pstate driver; so I tried disabling it by adding intel_pstate=disable to the kernel parameters in /etc/defaults/grub and updating grub; however, after the reboot, nothing changed and I'm still unable to switch to the "userspace" governor.

tl;dr

How can I enable the "userpace" governor?

– or –

How can I set the CPU frequency to always stay at its maximum?

Best Answer

Here is another method. If you want to attempt this suggestion, undo any changes caused by cpufreq and intel pstate settings. Also, disable any governor settings

  1. Install TLP - a tool whose main purpose is power management. It has a lot more features though like configuring cpu frequencies.

    sudo add-apt-repository ppa:linrunner/tlp; sudo apt-get update; sudo apt-get install tlp tlp-rdw

    sudo gedit /etc/default/tlp

Find these lines

CPU_SCALING_MIN_FREQ_ON_AC=0

CPU_SCALING_MAX_FREQ_ON_AC=0

CPU_SCALING_MIN_FREQ_ON_BAT=0

CPU_SCALING_MAX_FREQ_ON_BAT=0

Change the 0's all to 2500000 where this is the frequency in khz which = 2.5ghz.

Save and now monitor your cpu freq.

More info and sources: http://linrunner.de/en/tlp/docs/tlp-linux-advanced-power-management.html#installation

http://linrunner.de/en/tlp/docs/tlp-configuration.html#scaling

http://linrunner.de/en/tlp/docs/tlp-faq.html#scaling

Related Question