Power saving on Linux

From Smop.co.uk

Jump to: navigation, search

Contents

Power saving on Linux

Powertop

This is all done on my Dell D630 FWIW using powertop.

powertop is nice, but to be honest it's the suggestions that it comes up with that I really like - I just wish it would print them all in one go. In fact you can see all suggestions using the following trick:

strings `which powertop`

The power readings fluctuate a fair bit (BTW if you see a "no ACPI power usage estimate available" message, then unplug your laptop from the mains).

Initial

Well in normal usage the box is idle, running at 800MHz (out of 2.2GHz). Powertop says:

Cn                Avg residency       P-states (frequencies)
C0 (cpu running)        ( 4.1%)         2.21 Ghz     0.0%
C1                0.0ms ( 0.0%)         2.21 Ghz     0.0%
C2                2.3ms ( 2.9%)         1.60 Ghz     0.0%
C3                2.1ms (93.0%)          800 Mhz   100.0%


Wakeups-from-idle per second : 446.2    interval: 10.0s
Power usage (ACPI estimate): 19.0W (2.4 hours)

Top causes for wakeups:
  44.8% (179.1)       <interrupt> : extra timer interrupt 
  23.5% ( 93.9)             skype : schedule_timeout (process_timeout) 
  15.2% ( 61.0)       <interrupt> : nvidia 
   4.6% ( 18.3)       <interrupt> : ahci, ipw3945, eth0 
   3.1% ( 12.5)      S20powernowd : queue_delayed_work_on (delayed_work_timer_fn
   2.0% (  8.0)   <kernel module> : usb_hcd_poll_rh_status (rh_timer_func)

That wattage varies a a bit - only between 18.7W and 19.0W ATM.

UUn

laptop_mode

Added to /etc/rc.local:

  • echo 5 > /proc/sys/vm/laptop_mode

This enables laptop-mode (using laptop-mode-tools) - it spins down the hard disk (perhaps too often though, shortening the life of the disk) and make data transfer more bursty so that the hard disk can power down for longer periods of time.

This didn't show a change for me.

disable CD-ROM polling

Run:

  • hal-disable-polling --device /dev/scd0 'hal'

This stops the CD-ROM being polled. Interestingly this patch has just been sent to the LKML though it says very few drives currently support it.

This didn't appear to show a change for me.

nvidia vblank interrupts

Edit /etc/X11/xorg.conf, in the driver section add this and restart X:

  • Option "OnDemandVBlankInterrupts" "True"

This made the nvidia interrupt completely disappear (notice that it was ~ 60 times per second). Even if I move windows around on the screen it never shows up at all.

Saving: 60 wakeups/second, 0.6W. (down to 385/19.4W)

nvidia underclocking

Edit /etc/X11/xorg.conf, in the driver section add this and restart X:

  • Option "Coolbits" "1"

This lets us overclock and underclock the graphics card - since it's normally used for overclocking, "hotbits" would be a better name!

Now run "nvidia-settings". To change the clock frequencies, you must scroll down the license agreement and accept it. For me, the clock frequencies were set to:

  • 2D: GPU: 169, Memory: 100
  • 3D: GPU: 400, Memory: 594

Dropping 2D to half this, produced no savings in wakeups but a substantial power saving. NB: there seemed to be a bug in nvidia-settings where the "Apply" button on 2D wouldn't always hilight and I'd need to select 3D, then back to 2D.

Saving: 0 wakeups/second, 0.9W (down to 385/18.2W)

Tried

  • parallel port: parport, parport_pc, lp (no change, but then I've disabled it in the BIOS)
  • 1394 (firefire): ieee1396, ohci1394, spb2 (no change)
  • CD-ROM: unloading cdro,sr_mod module (or physically removing drive) seems to make no difference
    • can we turn the controller off? echo -n 1 > /sys/bus/scsi/devices/3:0:0:0/power/state doesn't work
  • serial (enabled in BIOS)

TODO

  • CONFIG_NO_HZ kernel (2.6.23 kernel required on 64-bit boxes)
  • bluetooth (hciconfig hci0 down ; rmmod hci_usb, rmmod bluetooth? bios?)
  • wireless - see here and here
  • USB - see 2nd link above, usbcore.autosuspend=1 to the kernel command line in the grub config, rmmod uhci_hcd
  • other modules
  • modem, pcmcia
  • wired ethernet (100MB, disable?)
  • external VGA (isn't detected - am I going to be "reboot dell" each time - still?)
  • sound:
    • echo 10 > /sys/module/snd_hda_intel/parameters/power_save

Current position

Cn                Avg residency       P-states (frequencies)
C0 (cpu running)        ( 3.3%)         2.21 Ghz     0.0%
C1                0.0ms ( 0.0%)         2.21 Ghz     0.0%
C2                2.7ms ( 0.6%)         1.60 Ghz     0.0%
C3                2.5ms (96.1%)          800 Mhz   100.0%


Wakeups-from-idle per second : 386.4    interval: 10.0s
Power usage (ACPI estimate): 18.2W (0.8 hours)

Top causes for wakeups:
  54.1% (180.5)       <interrupt> : extra timer interrupt 
  27.9% ( 93.3)             skype : schedule_timeout (process_timeout) 
   3.7% ( 12.5)       <interrupt> : ahci, ipw3945, eth0 
   3.7% ( 12.5)      S20powernowd : queue_delayed_work_on (delayed_work_timer_fn
   2.4% (  7.9)   <kernel module> : usb_hcd_poll_rh_status (rh_timer_func)
   0.9% (  3.1)              Xorg : do_setitimer (it_real_fn)

Biggest culprits of wakeups:

  • 28% skype - skype is a cpu hog and this shows that's extends to killing the batter too. Oh, this is with skype "offline", though being online doesn't make it any worse. This is a [known Skype bug https://developer.skype.com/jira/browse/SCL-145].
  • 4% ahci, ipw3945, eth0
  • 4% powernowd :-)

As an experiment I unloaded all modules I could (pretty much - even the mouse!) and used the hardware switch to disable wireless and bluetooth. This dropped the power consumption to 16.3W (still just about 380 wakeups a second). Turning the brightness down dropped it to 15.8W, increasing it raised it to 20.9W. I guess unlike some LCDs these do consume more power to display a bright picture!

Personal tools