Difference between revisions of "Power saving"

From ArchWiki
Jump to: navigation, search
(From powertop, needs to be cleaned up and merged: just merge)
(fix headers)
Line 66: Line 66:
 
{{hc|/etc/sysctl.d/laptop_mode.conf|2=vm.laptop_mode = 5}}
 
{{hc|/etc/sysctl.d/laptop_mode.conf|2=vm.laptop_mode = 5}}
  
== See also ==
+
== SATA Active Link Powermanagement ==
 
+
* [[CPU Frequency Scaling]]
+
 
+
=== SATA Active Link Powermanagement ===
+
 
{{accuracy|reason=Should be done with a udev rule, and the latency implications should be explained.}}
 
{{accuracy|reason=Should be done with a udev rule, and the latency implications should be explained.}}
 
  echo min_power > /sys/class/scsi_host/host0/link_power_management_policy
 
  echo min_power > /sys/class/scsi_host/host0/link_power_management_policy
  
=== USB Autosuspend ===
+
== USB Autosuspend ==
 
{{accuracy|reason=Should be done with a udev rule.}}
 
{{accuracy|reason=Should be done with a udev rule.}}
 
To enable USB autosuspend after 2 seconds of inactivity:
 
To enable USB autosuspend after 2 seconds of inactivity:
Line 80: Line 76:
 
  for i in `find /sys/bus/usb/devices/*/power/autosuspend`; do echo '''2''' > $i; done;
 
  for i in `find /sys/bus/usb/devices/*/power/autosuspend`; do echo '''2''' > $i; done;
  
=== Device Power Management ===
+
== Device Power Management ==
 
{{accuracy|reason=Should be done with a udev rule.}}
 
{{accuracy|reason=Should be done with a udev rule.}}
  
Line 86: Line 82:
 
  echo auto | tee /sys/bus/spi/devices/*/power/control > /dev/null
 
  echo auto | tee /sys/bus/spi/devices/*/power/control > /dev/null
  
=== View Power Setings ===
+
== View Power Setings ==
 
This function shows various power settings.  Note you either must be root or you must have sudo.
 
This function shows various power settings.  Note you either must be root or you must have sudo.
  
Line 117: Line 113:
 
   ';
 
   ';
 
}</nowiki>}}
 
}</nowiki>}}
 +
 +
== See also ==
 +
 +
* [[CPU Frequency Scaling]]

Revision as of 00:28, 3 November 2012

Audio

By default, audio power saving is turned off by most drivers. It can be enabled by setting the power_save parameter to a time (in seconds) to go in idle.

Note: Toggling the audio card's power state can cause a popping sound or noticeable latency on some broken hardware.
Intel
/etc/modprobe.d/audio_power_save.conf
options snd_hda_intel power_save=1
ac97
/etc/modprobe.d/audio_power_save.conf
options snd_ac97_codec power_save=1

Bluetooth

Tango-view-fullscreen.pngThis article or section needs expansion.Tango-view-fullscreen.png

Reason: The device should likely be disabled with hciconfig first. (Discuss in Talk:Power saving#)
Blacklist the hci_usb module if the driver is loaded automatically.

Disabling NMI watchdog

The NMI watchdog is a debugging feature to catch hardware hangs and cause a kernel panic. On some systems it can generate a lot of interrupts, causing a noticeable increase in power usage.

/etc/sysctl.d/disable_watchdog.conf
kernel.nmi_watchdog = 0

or add nmi_watchdog as a kernel parameter to disable it completely from early boot.

Disabling Wake-on-LAN

Wake-on-LAN can be a useful feature, but if you're not making use of it then it's simply draining extra power waiting for a magic packet while in suspend.

Disabling for one interface:

Note: This should be combined with static naming of devices, the eth* names are not static.
/etc/udev/rules.d/disable_wol_eth0.rules
ACTION=="add", SUBSYSTEM=="net", KERNEL=="net0" RUN+="/usr/sbin/ethtool -s net0 wol d"

Disabling for all interfaces:

/etc/udev/rules.d/disable_wol.rules
ACTION=="add", SUBSYSTEM=="net", KERNEL=="eth*" RUN+="/usr/sbin/ethtool -s %k wol d"

PCI Runtime Power Management

/etc/udev/rules.d/pci_pm.conf
ACTION=="add", SUBSYSTEM=="pci", ATTR{power/control}="auto"

Wireless power saving

Enabling for a specific interface:

Note: This should be combined with static naming of devices, the eth* names are not static.
/etc/udev/rules.d/wlan0_power_save.rules
ACTION=="add", SUBSYSTEM=="net", KERNEL=="wifi0" RUN+="/usr/sbin/iw dev wifi0 set power_save on"

Enabling for all interfaces:

/etc/udev/rules.d/wifi_power_save.rules
ACTION=="add", SUBSYSTEM=="net", KERNEL=="wlan*" RUN+="/usr/sbin/iw dev %k set power_save on"

Writeback Time

Increasing the VM dirty writeback time can help to aggregate I/O together - reducing disk writes, and decreasing power usage:

/etc/sysctl.d/dirty_writeback.conf
vm.dirty_writeback_centisecs = 1500

To do the same for journal commits with ext4 and some other filesystems, use commit=15 as a parameter in fstab or with the rootflags kernel parameter.

Laptop Mode

/etc/sysctl.d/laptop_mode.conf
vm.laptop_mode = 5

SATA Active Link Powermanagement

Tango-inaccurate.pngThe factual accuracy of this article or section is disputed.Tango-inaccurate.png

Reason: Should be done with a udev rule, and the latency implications should be explained. (Discuss in Talk:Power saving#)
echo min_power > /sys/class/scsi_host/host0/link_power_management_policy

USB Autosuspend

Tango-inaccurate.pngThe factual accuracy of this article or section is disputed.Tango-inaccurate.png

Reason: Should be done with a udev rule. (Discuss in Talk:Power saving#)

To enable USB autosuspend after 2 seconds of inactivity:

for i in `find /sys/bus/usb/devices/*/power/control`; do echo auto > $i; done;
for i in `find /sys/bus/usb/devices/*/power/autosuspend`; do echo 2 > $i; done;

Device Power Management

Tango-inaccurate.pngThe factual accuracy of this article or section is disputed.Tango-inaccurate.png

Reason: Should be done with a udev rule. (Discuss in Talk:Power saving#)
echo auto | tee /sys/bus/i2c/devices/*/power/control > /dev/null
echo auto | tee /sys/bus/spi/devices/*/power/control > /dev/null

View Power Setings

This function shows various power settings. Note you either must be root or you must have sudo.

function aa_power_settings ()
{ 
  sudo bash -c '
    for i in `find /sys/devices -name "bMaxPower"`;
    do
        for ii in `find $i -type f`;
        do
            bd=`dirname $ii`;
            busnum=`cat $bd/busnum`;
            devnum=`cat $bd/devnum`;
            title=`lsusb -s $busnum:$devnum`;
            echo -e "\n\n+++ $title\n  -$bd\n  -$ii";
            for ff in `find $bd/power -type f ! -empty 2>/dev/null`;
            do
                v=`cat $ff 2>/dev/null|tr -d "\n"`;
                [[ ${#v} -gt 0 ]] && echo -e " `basename $ff`=$v";
                v=;
            done | sort -g;
        done;
    done;
    echo -e "\n\n\n+++ Kernel Modules\n";
    for m in `command lspci -k|sed -n "/in use:/s,^.*: ,,p"|sort -u`;
    do
        echo "+ $m";
        systool -v -m $m 2> /dev/null | sed -n "/Parameters:/,/^$/p";
    done
  ';
}

See also