Improve Power Usage in Linux With TLP

Power management is always an issue in portable device. Be it a laptop or a mobile device, you always want the battery to last as long as possible without it dying on you. If you are running Linux on your laptop, you can make use of the TLP module to manage your computer’s power usage in the background.

TLP does a lot of power optimization to your system. The good thing is that it helps you to manage your system’s power usage without you having to understand every technical detail about your computer, and it runs in the background so you don’t have to worry about it at all.

A thing to note is that TLP does not replace the existing power management of your Linux installation. Instead, it has its own set of settings and it changes on every change of the power source.

The things that it manages include:

  • Kernel laptop mode and dirty buffer timeouts
  • Processor frequency scaling including “turbo boost” / “turbo core”
  • Power aware process scheduler for multi-core/hyper-threading
  • Hard disk advanced power magement level and spin down timeout (per disk)
  • SATA aggressive link power management (ALPM)
  • PCI Express active state power management (PCIe ASPM) – Linux 2.6.35 and above
  • Runtime power management for PCI(e) bus devices – Linux 2.6.35 and above
  • Radeon KMS power management – Linux 2.6.35 and above, not fglrx
  • Wifi power saving mode – depending on kernel/driver
  • Power off optical drive in drive bay (on battery)

To get started (in Ubuntu), run the following commands in the terminal to install TLP:

sudo add-apt-repository ppa:linrunner/tlp
sudo apt-get update 
sudo apt-get install tlp

For all other distros, check out the installation guide here.

Once installed, you can restart your computer for it to run automatically, or issue the command:

sudo tlp start

to get it started.

To view the configuration, use the command:

sudo tlp stat -c

This will show TLP’s default configuration:

tlp-configuration

The default configuration should work in most cases, but if you want to customize the settings for your machine, you can make amendment to the configuration file located at “/etc/default/tlp”.

sudo nano /etc/default/tlp

At any point of time, you can use the command:

sudo tlp stat

to view the customization that TLP has done to your system. You can also use various flags, like -b, -r to zoom in to the specific section. For example, sudo tlp stat -b will show only the battery information, while sudo tlp stat -r will show the radio devices switch state

tlp-radio-device-state

The bad thing about any power optimization app (and it is not the fault of TLP) is that there is no way to tell if your battery life has really improved. The only way to test it is to use your own judgement and see if your battery has lasted longer, with the same usage, after the optimization.

To prevent TLP from running automatically, you will have to uninstall it or disable it (set the TLP_ENABLE value to 0) in the configuration file.

If you have used TLP, let us know if it has helped you improved your battery life.

Image credit: Power On by BigStockPhoto