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?
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
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
When you use
performance
mode the CPU frequencies will always be as high as is reasonable. Note that the processor itself can backoff the CPU frequency under no or extremely light load conditions, regardless of what it is told to do via the frequency driver. There is no CPU frequency verses load response more aggressive thanperformance
mode.Disclaimer: The majority of my experience is with the intel_pstate driver.
EDIT:
Please be careful as to how reported CPU frequencies are interpreted. When you are using the acpi-cpufreq driver you get the CPU frequencies asked for, not the actual CPU frequencies. With the intel_pstate driver you get the actual CPU frequency averaged over the last sample interval. In my opinion, the acpi-cpufreq driver gives very misleading information in this area.