Power management

From ArchWiki
Revision as of 03:01, 18 June 2012 by Fengchao (Talk | contribs) (Use internal wiki link.)

Jump to: navigation, search

The aim of this page is to try to gather all the informations which are available on the topic of linux power management features. There are several places where one can change power management settings:

Power settings you set in one place could be overwritten in another place.

Where To Change Power Settings

One can pass a kernel command line parameter in the boot loader to activate power management features in certain kernel modules. If you are using systemd you can change some power management options in systemd config files or execute your own config file. pm-utils and upower are working together. pm-utils is responsible for changing the power management options while upower informs pm-utils about system changes. For example if you umplug your laptop from AC upower will signal to pm-utils that the laptop is running on battery. This will cause pm-utils to change some power management options according to it's config files.

Kernel Command Line Parameters

Append the lines to your kernel command line parameter to enable these options. If you change settings for kernel modules make sure they are either compiled into your initrd (insert module name in MODULES in /etc/mkinitcpio.conf) or pass an option via a modprobe config file (Kernel_modules#Using_files_in_.2Fetc.2Fmodprobe.d.2F).

PCI-e ASPM

 pcie_aspm=force

Disable NMI Watchdog

 nmi_watchdog=0

Enable RC6 Power Save Options

 i915_enable_rc6=#Nr

Where #Nr:

  • 1: enable rc6
  • 3: enable rc6 and deep rc6
  • 5: enable rc6 and deepest rc6
  • 7: enable rc6, deep and deepest rc6

Activate Power Save For Intel HD Audio

 snd_hda_intel.power_save=1

Change Usbcore Autosuspend Time

 usbcore.autosuspend=

Systemd Settings

There is a nice blog post from Andrea Scarpino about using systemd for power management: Power Saving With Systemd

pm-utils Settings

The pm-utils (see also: Pm-utils#Power_saving) package provides quirks for suspend to RAM and suspend to disk but also includes some scripts for power management. You need upower which registers power changes and signals that information to pm-utils.

Enable SATA Link Power Management

Execute the following command to enable SATA link power management when on battery:

 # echo SATA_ALPM_ENABLE=true > /etc/pm/config.d/sata_alpm

Scripts For Pm-utils Which Enable Power Management Options

These scripts have to be made executable via

 # chmod +x <script file>

Enable Runtime PM for PCI Devices

/etc/pm/power.d/device_pm
#!/bin/sh

device_pm() {
    for dpcontrol in /sys/bus/{pci,spi,i2c}/devices/*/power/control; do
        [ -w "$dpcontrol" ]

Enable Power Management For USB Devices

/etc/pm/power.d/usb_pm
#!/bin/sh
case "$1" in
    true)
       # USB powersaving
        for i in /sys/bus/usb/devices/*/power/autosuspend; do
            echo 1 > $i
        done
        for i in /sys/bus/usb/devices/*/power/control; do
            echo auto > $i
        done
	sysctl kernel.nmi_watchdog=0
    ;;
    false)
        for i in /sys/bus/usb/devices/*/power/autosuspend; do
            echo 2 > $i
        done
        for i in /sys/bus/usb/devices/*/power/control; do
            echo on > $i
        done
	sysctl kernel.nmi_watchdog=1
    ;;
esac

exit 0

Increase VM Writeback Timeout

/etc/pm/power.d/vm_writeback_timeout_pm
#!/bin/sh
case "$1" in
    true)
       # Less VM disk activity. Suggested by powertop
        echo 1500 > /proc/sys/vm/dirty_writeback_centisecs
    ;;
    false)
       #Return settings to default on AC power
        echo 500 > /proc/sys/vm/dirty_writeback_centisecs
    ;;
esac

exit 0

See Also

CPU Frequency Scaling