scarpino.dev

Power saving with systemd

So, powertop 2.0 has been released. I given it a try and it found a couple of bad tunnables; Powertop allows to ‘fix’ them using its interface, but the fix isn’t permanent.

So, how do I permanently fix them?

First of all I did a search in the web on how to fix them; what I found is a bunch of echos. With initscripts I’d use /etc/rc.local to set the values each time my system starts, but I removed it since I switched to systemd. I did ask in #systemd on IRC and the guys told me to use tmpfiles.d. What’s that? (man tmpfiles.d)

I made this /etc/tmpfiles.d/powersaving.conf file which sets the values of the stuff in /sys

# Enable SATA link power management for /dev/sda
w /sys/class/scsi_host/host0/link_power_management_policy  -  -  -  -  min_power
w /sys/class/scsi_host/host1/link_power_management_policy  -  -  -  -  min_power
w /sys/class/scsi_host/host2/link_power_management_policy  -  -  -  -  min_power
w /sys/class/scsi_host/host3/link_power_management_policy  -  -  -  -  min_power

# Autosuspend for USB device Askey for Toshiba
w /sys/bus/usb/devices/6-1/power/control                 -  -  -  -  auto

# Runtime PM for PCI Device Intel Corporation Mobile 4 Series Chipset Memory Controller Hub
w /sys/bus/pci/devices/0000:00:00.0/power/control        -  -  -  -  auto

# Runtime PM for PCI Device Intel Corporation Mobile 4 Series Chipset Integrated Graphics Controller
w /sys/bus/pci/devices/0000:00:02.0/power/control        -  -  -  -  auto

# Runtime PM for PCI Device Intel Corporation Mobile 4 Series Chipset Integrated Graphics Controller
w /sys/bus/pci/devices/0000:00:02.1/power/control        -  -  -  -  auto

# Runtime PM for PCI Device Intel Corporation 82801I (ICH9 Family) USB UHCI Controller #4
w /sys/bus/pci/devices/0000:00:1a.0/power/control        -  -  -  -  auto

# Runtime PM for PCI Device Intel Corporation 82801I (ICH9 Family) USB UHCI Controller #5
w /sys/bus/pci/devices/0000:00:1a.1/power/control        -  -  -  -  auto

# Runtime PM for PCI Device Intel Corporation 82801I (ICH9 Family) USB UHCI Controller #6
w /sys/bus/pci/devices/0000:00:1a.2/power/control        -  -  -  -  auto

# Runtime PM for PCI Device Intel Corporation 82801I (ICH9 Family) USB2 EHCI Controller #2
w /sys/bus/pci/devices/0000:00:1a.7/power/control        -  -  -  -  auto

# Runtime PM for PCI Device Intel Corporation 82801I (ICH9 Family) HD Audio Controller
w /sys/bus/pci/devices/0000:00:1b.0/power/control        -  -  -  -  auto

# Runtime PM for PCI Device Intel Corporation 82801I (ICH9 Family) PCI Express Port 1
w /sys/bus/pci/devices/0000:00:1c.0/power/control        -  -  -  -  auto

# Runtime PM for PCI Device Intel Corporation 82801I (ICH9 Family) PCI Express Port 5
w /sys/bus/pci/devices/0000:00:1c.4/power/control        -  -  -  -  auto

# Runtime PM for PCI Device Intel Corporation 82801I (ICH9 Family) PCI Express Port 6
w /sys/bus/pci/devices/0000:00:1c.5/power/control        -  -  -  -  auto

# Runtime PM for PCI Device Intel Corporation 82801I (ICH9 Family) USB UHCI Controller #1
w /sys/bus/pci/devices/0000:00:1d.0/power/control        -  -  -  -  auto

# Runtime PM for PCI Device Intel Corporation 82801I (ICH9 Family) USB UHCI Controller #2
w /sys/bus/pci/devices/0000:00:1d.1/power/control        -  -  -  -  auto

# Runtime PM for PCI Device Intel Corporation 82801I (ICH9 Family) USB UHCI Controller #3
w /sys/bus/pci/devices/0000:00:1d.2/power/control        -  -  -  -  auto

# Runtime PM for PCI Device Intel Corporation 82801I (ICH9 Family) USB2 EHCI Controller #1
w /sys/bus/pci/devices/0000:00:1d.7/power/control        -  -  -  -  auto

# Runtime PM for PCI Device Intel Corporation 82801 Mobile PCI Bridge
w /sys/bus/pci/devices/0000:00:1e.0/power/control        -  -  -  -  auto

# Runtime PM for PCI Device Intel Corporation ICH9M-E LPC Interface Controller
w /sys/bus/pci/devices/0000:00:1f.0/power/control        -  -  -  -  auto

# Runtime PM for PCI Device Intel Corporation 82801IBM/IEM (ICH9M/ICH9M-E) 4 port SATA Controller [AHCI mode]
w /sys/bus/pci/devices/0000:00:1f.2/power/control        -  -  -  -  auto

# Runtime PM for PCI Device Intel Corporation 82801I (ICH9 Family) SMBus Controller
w /sys/bus/pci/devices/0000:00:1f.3/power/control        -  -  -  -  auto

# Runtime PM for PCI Device Atheros Communications Inc. AR8132 Fast Ethernet
w /sys/bus/pci/devices/0000:07:00.0/power/control        -  -  -  -  auto

# Runtime PM for PCI Device Realtek Semiconductor Co., Ltd. RTL8191SEvB Wireless LAN Controller
w /sys/bus/pci/devices/0000:08:00.0/power/control        -  -  -  -  auto

In addition, I used sysctl to set the values of the stuff in /proc

# Turn OFF NMI watchdog
kernel.nmi_watchdog = 0

I don’t set vm.laptop_mode and vm.dirty_writeback_centisecs because they’re already set by pm-utils ;)

Go and save power! :)

Tags: arch linux, howto, linux

By Andrea Scarpino on 2012-05-14

Discuss on HackerNews