Files
oam/knowledge base/linux/lower the power consumption.md
2025-06-30 00:43:07 +02:00

3.7 KiB

Lower the power consumption

  1. TL;DR
  2. Disable unused services
  3. Improve battery performance
  4. Tune power-related settings
  5. Further readings

TL;DR

  1. Disable unused services.
  2. Tune power-related settings.
  3. [if using a battery] Improve battery performance.
  4. Turn off the NMI watchdog hardlockup detector.
    The NMI watchdog is a debugging feature to catch hardware hangs that cause a kernel panic. On some systems it can generate a lot of interrupts, causing a noticeable increase in power usage.
  5. Bump SATA Active Link Power Management to a higher setting.
  6. Increase the virtual memory dirty writeback time to help aggregating disk I/O.
    This reduces spanned disk writes.
# Summarize performance of the last boot.
sudo systemd-analyze

# Show last boot performance.
# Also shows the process tree.
sudo systemd-analyze critical-chain

# Check power stats.
sudo powertop

# Set all tunable options to their `GOOD` setting.
# Calibration is interactive.
sudo powertop --calibrate && sudo powertop --auto-tune

# Turn off the NMI watchdog hardlockup detector.
echo '0' > '/proc/sys/kernel/nmi_watchdog'

# Bump SATA Active Link Power Management to a higher setting.
echo 'med_power_with_dipm' > '/sys/class/scsi_host/host0/link_power_management_policy'

# Increase the virtual memory dirty writeback time to help aggregating disk I/O.
# Value is in 1/100s of seconds. Default is 500 (5 seconds).
echo 6000 > '/proc/sys/vm/dirty_writeback_centisecs'
sudo sysctl vm.dirty_writeback_centisecs=6000

Disable unused services

$ sudo systemd-analyze
Startup finished in 13.129s (firmware) + 5.413s (loader) + 1.746s (kernel) + 7.903s (userspace) = 28.192s
graphical.target reached after 1.239s in userspace

$ sudo systemd-analyze critical-chain
The time when unit became active or started is printed after the "@" character.
The time the unit took to start is printed after the "+" character.

graphical.target @1.239s
└─multi-user.target @1.239s
  └─ModemManager.service @1.154s +84ms
    └─polkit.service @937ms +215ms
      └─basic.target @928ms
        └─sockets.target @928ms
          └─dbus.socket @928ms
            └─sysinit.target @924ms
              └─systemd-backlight@backlight:acpi_video0.service @2.273s +8ms
                └─system-systemd\x2dbacklight.slice @2.272s
                  └─system.slice @197ms
                    └─-.slice @197ms

Improve battery performance

# Enable automatic power management.
# See `tlpui` on GitHub for UI.
sudo systemctl enable --now 'tlp.service'
sudo vim '/etc/tlp.conf'

# Check power stats.
sudo 'powertop'
sudo powertop --calibrate
sudo powertop --auto-tune

Further readings