3

I nearly tried all the solution to scale the cpu frequency but no success. I have Intel Core i5-3210m 2.5Ghz-3.1Ghz. I want to permanently set it to 1.6Ghz with no turbo boost to improve battery timings. Please tell it accordance with intel_pstate driver.

0
7

To limit the upper CPU frequency with the intel_pstate driver to 52% do:

echo "52" | sudo tee /sys/devices/system/cpu/intel_pstate/max_perf_pct

Note 1: In calculating 52%, I have assumed that you have turbo enabled, for a max pstate of 31. Therefore 1.6 / 3.1 = 52%. If you have disabled turbo then the number would be 64%. There is no need to specifically disable turbo, as with this limit, it will never go into the turbo range anyhow.

Note 2: Depending on your applications and processor, limiting CPU frequency might not result in the longest battery life. In some cases, completing the task faster, via higher CPU frequency, and therefore allowing some CPUs to go into deep sleep (highest C state) sooner and for longer, can result in less power consumption overall.

Note 3: The solution is not permanent, and the setting will be lost upon re-boot. I suggest you try it for awhile, report back and then we can think about how to make it permanent. There are other higher level tools for this, but I never use them. Someone else might provide another anwswer involving the higher level tools.

An example (different processor, different numbers). CPU 7 is under 100% load:
Before setting upper frequency limit:

$ grep MHz /proc/cpuinfo
cpu MHz         : 3697.234
cpu MHz         : 3655.796
cpu MHz         : 3699.890
cpu MHz         : 3742.257
cpu MHz         : 3613.562
cpu MHz         : 3670.273
cpu MHz         : 3628.968
cpu MHz         : 3799.898

Now, limit the upper frequency, and check it:

$ echo "50" | sudo tee /sys/devices/system/cpu/intel_pstate/max_perf_pct
50
$ cat /sys/devices/system/cpu/intel_pstate/max_perf_pct
50
$ grep MHz /proc/cpuinfo
cpu MHz         : 1899.882
cpu MHz         : 1900.015
cpu MHz         : 1899.882
cpu MHz         : 1893.906
cpu MHz         : 1899.351
cpu MHz         : 1900.015
cpu MHz         : 1899.750
cpu MHz         : 1899.882

EDIT: Watch for backporting of the intel_pstate driver changes for whatever is your stock kernel. I know backporting is being done, but I do not know the release timelines.

To make the change always occur during boot, first make it a script, for example:

$ cat set_cpu_max_perf_pct
#! /bin/bash

echo 52 >/sys/devices/system/cpu/intel_pstate/max_perf_pct
echo -n "intel_pstate maximum performance request is (percent): "
cat /sys/devices/system/cpu/intel_pstate/max_perf_pct

Test the script, running as sudo. Then refer to one of the many other questions and answers that address making it run during boot. Say, this one.

Alternatively, you can install tools like TLP which have these settings in the configuration file with parameter for battery or ac and automatic switch.

11
  • When I check cpufreq-info it sometime goes above 2Ghz. I think the command didn't work.
    – AhmedBilal
    Aug 28 '15 at 4:46
  • I'll edit a method of checking into my answer. Aug 28 '15 at 5:13
  • I am not familiar with cpufreq-info. I only trust primitives, as in the example I edited into my answer. I also trust results from turbostat. Aug 28 '15 at 5:26
  • 1
    Would you be willing to try kernel 4.2, to see if your issue still occurs? It has some changes to the intel_pstate driver. If the issue still occurs, there is also some additional trace information available, and that will be the next step. Are you running anything unusual that might be attempting to adjust target pstates on it own? Sep 2 '15 at 14:25
  • 1
    Thank you very much. I installed kernel 4.2 and from advance boot option I select Ubuntu Kernel 4.2 Generic. When I run the above commands it surprisingly limit the frequency. I checked several times. It max at 1.6Ghz which is perfectly fine. Now, please tell me how to limit the frequency permanently. Thank you again :)
    – AhmedBilal
    Sep 3 '15 at 5:05

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.