Adventures in Linux power savings

I was looking at the power consumption in my laptop and was using powertop to see what was happening – the CPU was spending some time in the lower power states (C3 and up), but was mostly in the C1E state – this was when the laptop was mostly idle (a few chrome windows and pidgin running). When I pulled the power cord out, linux was reporting that I had ~4.5 hours of use left.

So I started looking into what the states were, what they meant and if there were any options I could enable to decrease power usage 🙂

I’m running kernel 3.11 on the laptop, which I discovered has support for a cpu frequency governor called intel_pstate (to replace the acpi-cpufreq default), which was designed for use on Sandy Bridge and newer CPU’s. On Linux Mint though, it’s disabled by default as it has caused some problems for some people. I enabled it and had another look at powertop – each core was spending upwards of 95% in the C7 state, each core was ~90% and the package was around ~80%. I removed the power cord again – now I get ~5.5 hours use, quite good for a single kernel argument being passed!

To add the argument to the boot process, I updated /etc/default/grub to “include intel_pstate=enable” to the GRUB_CMDLINE_LINUX_DEFAULT line, ran update-grub and now I get the improved power usage by default 🙂

Me being the technical minded person I am , I was curious to what the various c-states mean. After a bit of Googling, I found the Intel datasheet for the Ivy Bridge CPU’s [PDF], which goes into details on what the various C-states are (amongst other things). In short, when the package is in the C7 state, the CPU is almost entirely powered down: the caches are all cleared and powered off, the internal CPU state is saved to SRAM and voltage dropped to 0V.

I’m seriously impressed that CPU’s can be almost entirely turned off as part of normal operation and can switch between full powered execution mode (C0) and deep power savings mode (C7) in a short space of time! I’m having trouble locating the exact timings to move from between the states, but considering I’ve not noticed any lag, I’m going to hazard a guess that it’ll be measured in microseconds (possibly less?).

Tagged with: ,

Leave a Reply

Your email address will not be published. Required fields are marked *

*