4

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?

  • Just curious what are your reasons for doing this? If you want to get more performance, this shouldn't give any noticeable performance gain over "ondemand", except in terms of heat generated and power used. The switching between CPU frequencies and voltages is so fast and responsive to load it should still maintain the best performance. Overclocking, for example, would be much better at giving a real performance gain. – thomasrutter Jun 12 '15 at 3:37
  • @thomasrutter: It depends on what the poster is doing. For example acpi-cpufreq, and the phoronix ffmpeg test (lower number is better): Performance mode 13.3 seconds; Ondemand mode 20.59 seconds. (that was a while ago, Kernel 3.15RC2) For completeness: Conservative mode 24.8; Powersave 29.0 – Doug Smythies Jun 12 '15 at 4:06
  • What accounted for the difference between performance and ondemand here? Shouldn't ffmpeg be pegging the CPU cores at max pretty much the whole time? – thomasrutter Jun 12 '15 at 4:10
  • @thomasrutter: ffmpeg does multithreading and rotating through CPUs in a particularly annoying way, such that it confuses frequency scaling drivers. No, typically ffmpeg doesn't pin the CPUs, it is more like about 50% each, depending. Some games do the same thing, resulting in the game dropping the frame rate because it thinks there isn't enough compute power and the frequency scaling driver not raising the target pstate because it doesn't think there is enough load. – Doug Smythies Jun 12 '15 at 5:56
  • For quick and easy control over your CPU frequency you might find this answer useful. – Elder Geek Feb 20 '17 at 12:21
2

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

1

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 than performance 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.

  • Someone downvoted my answer but didn't say why. I wish they would comment, so I could have a chance to address the concern. – Doug Smythies Jul 14 '15 at 18:34

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.