See [[hdparm#Power management configuration]] for drive parameters that can be set.

+

+

Limiting disk writes can help when the hard disk is in power save mode; generally though this thought is considered unrealistic as tracking all programs and how and when then write to disk can be laborious. Laptop-mode-tools has a program that can display programs that write to disk if willing to try. Also little things like setting {{ic|relatime}} or {{ic|noatime}} (see [[Fstab]]) can help. If enough RAM is available consider disabling (or limiting [[Swap|swapiness]]) can save a good amount of reduce disk writes.

=== Mount options ===

=== Mount options ===

Revision as of 15:13, 21 October 2014

This article covers the configuration needed to turn on power saving features. Almost all of the features listed here are worth using whether or not the computer is on AC or battery power. Most have negligible performance impact and are just not enabled by default because of commonly broken hardware/drivers. Reducing power usage means reducing heat, which can even lead to higher performance on a modern Intel or AMD CPU, thanks to dynamic overclocking.

Configuration

If you would like to create your own scripts and power saving settings such as by udev rules you can take the following settings as a reference.

Note: Most rules described below are also managed by tools like TLP and it is unwise to use multigoverning.

Audio

By default, audio power saving is turned off by most drivers. It can be enabled by setting the power_save parameter; a time (in seconds) to go into idle mode. To idle the audio card after one second, create

/etc/modprobe.d/audio_powersave.conf

options snd_hda_intel power_save=1

for Intel, or use

options snd_ac97_codec power_save=1

for ac97.

Note: Toggling the audio card's power state can cause a popping sound or noticeable latency on some broken hardware.

Backlight

When system starts, screen backlight is set to maximum by default. This can be fixed by specifying backlight level in the following udev rule:

In these examples, %k is a specifier for the kernel name of the matched device. For example, if it finds that the rule is applicable to wlan0, the %k specifier will be replaced with wlan0. To apply the rules to only a particular interface, just replace the pattern eth* and specifier %k with the desired interface name. For more information, see Writing udev rules.

In this case, the name of the configuration file is important. Due to the introduction of persistent device names via 80-net-name-slot.rules in systemd v197, it is important that the network powersave rules are named lexicographically before 80-net-name-slot.rules, so that they are applied before the devices are named e.g. enp2s0.

Bus power management

Active State Power Management

If the computer is believed not to support ASPM it and will be disabled on boot:

$ lspci -vv | grep ASPM.*abled\;

ASPM is handled by the BIOS, if ASPM is disabled it will be because [ref]:

The BIOS disabled it for some reason (for conflicts?).

PCIE requires ASPM but L0s are optional (so L0s might be disabled and only L1 enabled).

The BIOS might not have been programmed for it.

The BIOS is buggy.

If believing the computer has support for ASPM it can be forced on for the kernel to handle with the pcie_aspm=forcekernel parameter.

Warning:

Forcing on ASPM can cause a freeze/panic, so make sure you have a way to undo the option if it does not work.

On systems that do not support it forcing on ASPM can even increase power consumption.

To adjust to powersave do (the following command will not work unless enabled):

echo powersave | tee /sys/module/pcie_aspm/parameters/policy

By default it looks like this:

$ cat /sys/module/pcie_aspm/parameters/policy

[default] performance powersave

PCI Runtime Power Management

/etc/udev/rules.d/pci_pm.rules

ACTION=="add", SUBSYSTEM=="pci", ATTR{power/control}="auto"

Device power management

The factual accuracy of this article or section is disputed.

Reason: Mass enabling for nearly all devices has negative side effects (unwanted devices such as USB are included, worse performance of the udev rule since matching devices that enable power management by default is useless, harder troubleshooting, etc). Enabling per bus/class for the devices that need it should be recommended instead. (Discuss in Talk:Power saving#)

USB autosuspend

The linux kernel can automatically suspend USB devices when they are not in use. This can sometimes save quite a bit of power, however some USB devices are not compatible with USB power saving and start to misbehave (common for USB mice/keyboards). udev rules based on whitelist or blacklist filtering can help to mitigate the problem.

The most simple and likely useless example is enabling autosuspend for all USB devices:

Hard disk drive

Limiting disk writes can help when the hard disk is in power save mode; generally though this thought is considered unrealistic as tracking all programs and how and when then write to disk can be laborious. Laptop-mode-tools has a program that can display programs that write to disk if willing to try. Also little things like setting relatime or noatime (see Fstab) can help. If enough RAM is available consider disabling (or limiting swapiness) can save a good amount of reduce disk writes.

If you do not want to take care of the settings by yourself it is recommended to use these tools. But be aware of running only one of these tools to avoid possible conflicts as they all work more or less similar.

Using a script and an udev rule

Since systemd users can suspend and hibernate through systemctl suspend or systemctl hibernate and handle acpi events with /etc/systemd/logind.conf, it might be interesting to remove pm-utils and acpid. There is just one thing systemd cannot do (as of systemd-204): power management depending on whether the system is running on AC or battery. To fill this gap, you can create a single udev rule that runs a script when the AC adapter is plugged and unplugged:

The above udev rule should work as expected, but if your power settings are not updated after a suspend or hibernate cycle, you should add a script in /usr/lib/systemd/system-sleep/ with the following contents: