Forcing CPU speed

By | February 8, 2016

Most of the time tuned-adm can set fairly good power states, but I’ve noticed that when I want powersave as the active profile, to try and maximize the battery life – it will still run with an ondemand governor; In some cases, eg when on a plane and spending all the time in a text editor, thats not convenient ( either due to other apps running or when you really want to get that 7 hr battery life ).

On CentOS Linux 7, you can use a bit of a hammer solution in the form of /bin/cpupower – installed as a part of the kernel-tools rpm. This will let you force a specific cpu range with the frequency-set command with -d (min speed) and -u (max speed ) options, or just set a fixed rate with -f. As an example, here is what I do when getting on the plane

/bin/cpupower frequency-set -u 800Mhz

Stuff does get lethargic on the machine, but at 800Mhz and with all the external devices / interfaces / network bits turned off – I can still squeeze about 5 hrs of battery life from my X1 Carbon gen2 which has:

model: 45N1703
voltage: 14.398 V
energy-full-design: 45.02 Wh
capacity: 67.3701%

Ofcourse, you should still set “tuned-adm profile powersave” to get the other power save options, and watch powertop with your typical workload to get an idea on where there might be other tuning wins. And if anyone has thoughts on what to do when that battery capacity hits 50 – 60%… it does not look like the battery on this lenovo x1 is replaceable ( or even sold! ).


2 thoughts on “Forcing CPU speed

  1. Chris Yereaztian

    I was wondering what you think about the argument that some folks make that it’s usually better to let the CPU run at max speed for a very short amount of time – let it finish the task and then go back into one of the sleep states (presumably the deepest sleep state your cpu supports). If you limit / restrict the max cpu frequency it obviously takes longer to finish a computation, using more energy than it would have on a higher frequency. If your cpu doesn’t properly lower the core voltage in lower cpu frequency states (depends on the cpu, mainboard/chipset and bios settings) you might risk running your cpu at e.g. 800 MHZ with the same core voltage as it would on 1.6 GHZ, not saving any energy at all and staying longer in that state might actually reduce battery life even more. Obviously, the whole matter superbly depends on your system and varies from system to system. I have an old Sony Vaio TZ running 32bit Linux Mint with Mate and I can squeeze out almost 43 hours (with the ondemand governor) –

    My cpu is an old 1.3 GHZ Core2Duo which doesn’t lower the core voltage enough so I could actually benefit from lowering the cpu frequency (it varies between V0.9125 and 0.925V).

    I’m not arguing that limiting the cpu frequency cannot help prolonging your battery run time but I simply wanted to share my perspective that it highly depends on your machine and how well the cpu and core voltage scale.

Comments are closed.