Boost Battery Life on Your Linux Laptop with TLP

Laptop battery life is a crucial aspect of productivity, and mastering the art of extending it is essential. This article is not just about squeezing more hours out of a single charge, but about adopting practices and tweaks that ensure your laptop’s battery remains robust and reliable for years to come.

We will discuss Linux optimizations, where TLP configurations, CPU scaling, and smart charging practices are more than just settings; they’re the keys to unlocking your laptop’s full potential on Linux. Unlock additional hours of battery life after fine-tuning with Linux-specific tools.

Boost Battery Life on Your Linux Laptop

This article also serves as a follow-up to my ThinkPad T14s Gen 3 AMD Linux user review, where many of the included settings and tips were not exclusively specific to ThinkPads. As such, this page serves as a stand-alone guide for improving battery life on Linux Laptops, regardless of the manufacturer.

 

Consider your battery life requirements on Linux

Here are my requirements, I need about 4 to 6 hours of continues battery life at the very maximum. However, I will only need this, at most, once or twice a year. However, perhaps this is largely as a result of 11 years and 3 battery replacements, my previous Alienware 14 R3 laptop which only gave 1–2 hours of battery life on a good day. Yikes!

I’m using Kali Linux, and right after install, I got 6 to 8 hours of battery life on my ThinkPad T14s Gen 3 AMD laptop. Paired with Kali-i3 and system tweaks using TLP, that’s now improved to over 10 hours.

This transformation highlights a crucial point for Linux laptop users: understanding your specific battery needs and how often you’ll be relying on battery power alone is key.

For someone who seldom needs more than a couple of hours of unplugged usage, investing in extensive battery life might not be a priority.

However, for those who frequently find themselves away from power outlets, or for power users who demand heavy-duty performance without the tether of a charging cable, optimizing for longer battery life becomes essential.

Using tools like TLP, PowerTop or Laptop Mode Tools, the potential to significantly enhance battery life is substantial. This is where Linux shines, offering a level of control and customization that can transform a moderate battery life into an all-day endurance battery life.

So, when assessing your battery life needs, consider not just your current habits, but also how you might leverage Linux’s capabilities to meet, or even exceed, your future requirements.

 

Boost Battery Life of Linux Laptops

As mentioned, I installed TLP to extend battery life and get approximately an hour and a half of use per 10% of the battery charge. Also, to prolong the battery’s overall lifespan, I’ve limited the charging to a maximum of 80% and set a discharge threshold at 20%.

With these settings, I typically achieve around 7 to 8 hours of battery life in the 80% to 20% charge range. Let’s install TLP and configure it to achieve similar results.

Keep in mind, the outcomes might differ based on the specific hardware you’re using and its age.

For Ubuntu/Debian (and derivatives like Linux Mint, Pop!_OS), use:

sudo apt install tlp cpufrequtils

For Fedora, CentOS, RHEL and derivatives, use:

sudo dnf install tlp cpufrequtils

For Arch Linux and derivatives, use:

sudo pacman -S tlp tlp-rdw

Now, let’s enable TLP and configure it:

sudo systemctl enable tlp.service
sudo systemctl mask systemd-rfkill.service && sudo systemctl mask systemd-rfkill.socket
sudo systemctl restart tlp.service
sudo tlp-stat -p
sudo tlp-stat -b
sudo tlp-stat -s
sudo vi /etc/tlp.conf

My current TLP config:

screenshot of vi /etc/tlp.conf
Screenshot of my current /etc/tlp.conf

 

TLP Battery Saving Settings Explained

Set amd-pstate_driver mode

CPU_DRIVER_OPMODE_ON_AC=passive
CPU_DRIVER_OPMODE_ON_BAT=passive

In its non-autonomous (passive) mode, amd-pstate enables the Linux kernel to directly set the desired performance level through the Desired Performance Register. This mode is part of a trio of operational modes – autonomous (active), non-autonomous (passive), and guided autonomous (guided) – each selectable through different kernel parameters​​.

The ‘passive’ mode in amd-pstate thus not only allows for lower CPU idle clock speeds (400MHz) and the disabling of the “turbo core” feature but also integrates closely with the kernel’s management of CPU performance levels. This integration ensures a more tailored and efficient use of power and performance in accordance with the specific demands of the operating system and the applications running on it.

Reference: amd-pstate.

 

Set CPU scaling Governor

CPU_SCALING_GOVERNOR_ON_AC=ondemand
CPU_SCALING_GOVERNOR_ON_BAT=conservative

ondemand Governor: The “ondemand” CPUfreq governor dynamically adjusts the CPU frequency based on current usage. It requires the CPU to have the capability to switch frequencies very quickly. The kernel periodically assesses CPU usage, at intervals defined by the ‘sampling_rate’ parameter, to decide whether to adjust the frequency. This governor is designed to rapidly respond to system load changes, scaling up the CPU speed more frequently and almost instantaneously when needed​​.

conservative Governor: The “conservative” CPUfreq governor, similar to “ondemand”, also sets the CPU frequency based on the current usage. However, its behavior differs in that it gracefully increases and decreases the CPU speed, rather than abruptly jumping to maximum speed with any load. This more gradual approach to frequency scaling is particularly suitable for battery-powered environments, as it seeks to balance performance with power conservation, avoiding the rapid spikes in power consumption associated with quick frequency jumps​​.

By choosing conservative CPU scaling settings, you’re effectively opting for a more gradual and energy-efficient approach to managing your CPU’s performance, which is particularly beneficial for extending battery life.

 

Disable CPU boost/turbo

CPU_BOOST_ON_AC=1
CPU_BOOST_ON_BAT=0

Maintaining the CPU boost in its default ‘enabled’ state can improve single-core speed, which is beneficial for certain types of workloads. However, disabling the boost feature has been shown to markedly improve battery life and reduce operating temperatures. This is because the boost feature increases the CPU’s clock speed, thereby increasing power consumption and heat production.

CPU boost/turbo benchmark

Interestingly, turning off the boost doesn’t significantly impact multi-core performance, which is crucial for tasks that require multiple cores. Therefore, for users prioritizing battery life over peak CPU performance, especially in multi-core tasks, disabling the CPU boost is a prudent choice.

Reference: Optimizing TLP.

 

Platform/System Profiles

PLATFORM_PROFILE_ON_AC=balanced
PLATFORM_PROFILE_ON_BAT=low-power

An important aspect of TLP’s configuration involves selecting the appropriate platform profile. This setting governs the system’s operational characteristics, balancing power, performance levels, thermal management, and fan speed.

The choices typically include ‘performance’, ‘balanced’, and ‘low-power’, each representing a different focus on power saving and performance optimization.

For instance, the setting PLATFORM_PROFILE_ON_AC=balanced is chosen when the laptop is plugged into an AC power source. This ‘balanced’ profile offers a middle ground, optimizing both performance and power consumption while ensuring the system doesn’t overwork or overheat. It’s a perfect choice for regular usage where you need a blend of efficiency and power.

On the other hand, PLATFORM_PROFILE_ON_BAT=low-power is selected for when the laptop is running on battery. The ‘low-power’ profile significantly prioritizes power saving over performance. This setting reduces the energy demand of the system, thereby extending the battery life. It’s an ideal choice for situations where prolonging battery duration is more crucial than maximizing system performance, such as during travel or long periods away from a power source.

It’s important to note that the availability of these profiles and additional ones like ‘balanced-performance’, ‘quiet’, and ‘cool’ can vary depending on your hardware. Always check the output of tlp-stat -p to determine which profiles are supported by your system.

tlp-stat -s, tlp-stat -p and tlp-stat -b
Click here for a larger view of the above tlp-stat output.

 

AMD GPU power management

RADEON_DPM_PERF_LEVEL_ON_AC=auto 
RADEON_DPM_PERF_LEVEL_ON_BAT=low

This section is particularly relevant for laptops with AMD graphics cards and focuses on controlling the Dynamic Power Management (DPM) performance level.

The setting RADEON_DPM_PERF_LEVEL_ON_AC=auto is configured for scenarios when the laptop is plugged into an AC power source. In this ‘auto’ mode, the GPU dynamically adjusts its power consumption and performance based on current tasks. This setting is recommended as it allows the GPU to intelligently balance between high performance for demanding applications and lower power usage when the demand is minimal.

When the laptop is running on battery, the setting RADEON_DPM_PERF_LEVEL_ON_BAT=low comes into play. Here, the DPM is set to ‘low’, which means the GPU operates at a reduced performance level to conserve battery life. This setting is crucial for extending the battery runtime, especially in situations where GPU-intensive tasks are not a priority. By limiting the power usage of the GPU, the overall energy consumption of the laptop decreases, thereby prolonging the battery life.

It’s important to note that these settings require either the ‘amdgpu’ or ‘radeon’ driver to be in use. Users should ensure their system is using the appropriate drivers to take full advantage of these power management features.

Reference: TLP Graphics

TLP AMD GPU tlp-stat

 

Battery Smart Charge and Smart Capacity

START_CHARGE_THRESH_BAT0=50 
STOP_CHARGE_THRESH_BAT0=80

By adjusting the TLP settings on my laptop, I’ve effectively managed battery wear by setting specific charge thresholds. My charging limit is set at a maximum of 80%, and I receive alerts when the battery level falls to 20%, helping to avoid deep discharges.

Battery charge level impact chart
Battery charge level impact chart – Source: The Battery University

By maintaining the battery level between 80% and 20%, this not only optimizes my laptop’s battery life to about 7 to 8 hours, but also minimizes battery wear.

For various laptop usage scenarios, here are three examples of recommended TLP battery charge threshold settings. These configurations provide flexibility depending on the user’s mobility and usage patterns:

Frequent Travelers:

  • Start Charge Threshold: 75% (START_CHARGE_THRESH_BAT0=75)
  • Stop Charge Threshold: 80% (STOP_CHARGE_THRESH_BAT0=80)

This setting allows for more frequent charging cycles, ensuring the laptop is often ready for use on the go, while still preventing full charges that accelerate battery wear.

Mostly Stationary Users: (my current settings)

  • Start Charge Threshold: 50% (START_CHARGE_THRESH_BAT0=50)
  • Stop Charge Threshold: 80% (STOP_CHARGE_THRESH_BAT0=80)

This setup minimizes charging cycles, beneficial for users who mostly keep their laptop plugged in, extending the battery’s lifespan.

Balanced Approach:

  • Start Charge Threshold: 65% (START_CHARGE_THRESH_BAT0=65)
  • Stop Charge Threshold: 80% (STOP_CHARGE_THRESH_BAT0=80)

A balanced setup for both stationary and moderate mobility, offering a good mix of battery availability and longevity.

For more about these settings, see TLP’s Battery Care Vendor Specifics section and Reference: TLP battery care.

 

Additional Battery-Saving Tips


Source: Tom’s Hardware review of the highly recommended SK Hynix P41

Beyond configuring TLP settings, there are several other ways Linux users can squeeze out additional laptop battery life. These tips focus on reducing unnecessary power consumption while maintaining usability and performance:

  • Dim the Screen Brightness! – Display brightness is usually THE biggest power drains on laptops. Reducing it to the lowest comfortable level can significantly save battery power.
  • Manage Background Processes – Keep an eye on background processes. Use system monitors to identify and close unnecessary applications that consume CPU resources and, in turn, battery power.
  • Disable Unused Hardware – Turn off hardware components that are not in use, like Bluetooth, Wi-Fi, and external devices.
  • Opt for Lightweight Desktop Environments – Using a lighter desktop environment or window manager, such as LXDE, XFCE, or i3, (I’m using Kali-i3).
  • Limit Startup Applications – Reduce the number of applications that start automatically.
  • Adjust System Settings – Modify system settings to favor power savings. For example, set a shorter time for the screen to turn off when inactive and configure sleep or hibernate modes.
  • Use SSDs over HDDs – If possible, use NVMe Solid State Drives (SSDs). These are more energy-efficient and can contribute to longer battery life.
  • Regularly Update Your System – Updates often include optimizations for better performance and power efficiency.
  • Choose Energy-Efficient Software – Opt for applications known for their efficiency. For example, use vi instead of a GUI text editor. Small change, but everything ads up.

 

Conclusion

This article discuses methods to enhance the battery longevity of Linux laptops, with a specific focus on utilizing TLP. The key to extending battery life is managing the balance between power, thermal management, and efficiency.

The article highlights the importance of fine-tuning CPU governors and the potential benefits of turning off CPU boost functions. These adjustments are crucial for boosting your Linux laptop’s battery life. Customizing TLP settings according to your usage patterns can greatly amplify both the battery’s lifespan and its overall performance.

The article also places emphasis on the importance of setting effective charge thresholds. By carefully defining the limits to which your battery charges, you can avoid overcharging and undercharging scenarios, which are detrimental to the battery’s overall health and longevity.

The above tips, combined with effective TLP settings, provide a comprehensive approach to energy management on Linux laptops.

Tags: , ,



Top ↑