Improving Laptop Battery Life by selectively suspending tasks

ew9d

New member
Jun 18, 2023
10
0
1
I have a vision: Extend Battery Runtime by suspending, delaying, or reducing some functions when the battery is not fully charged (or when AC power not connected).
Wether the trigger should be AC absence, or less than 100% charge I guess depends on if your power adapter and power port are strong enough to charge at full speed while also under full load. That might require actual measurements on each laptop to know. And it might vary depending on which power supply you're using. I know I have had some in the past that could run the laptop, and charge it if I suspended/shutdown, but not charge it at the same time.

There are some core system functions that are just not that important they need to use up my battery:
Software updates. indexing filesystem contents for search. Log rotation. btrfs/zfs rebalances/garbage collection.

There are also some things I want to do, I tell the computer to do, which I do want done, but could gladly wait until I'm on AC:
Video encoding/rendering. Backups, Large Downloads, running VMs, execution of javascript and pages in non-focused browser tabs, perhaps any execution of any GUI application that is not visible on the screen?

I've already started to manage some of this with a cronjob that enables or disables systemd services, and I made a "WaitForAC" script that does that so from a shell can run "WaitForAC; bin/bigheavyprogram"

PowerTop can probably help identify where the power is going. And then for the top 10, 25, 50% of power use, I'd like to think about what it is, and make a decision if it should be limited on battery.

cgroups have been suggested as one way to do this. As has systemd, and acpid. My script currently polls upower -i /org/freedesktop/UPower/devices/line_power_ADP1 every 5 seconds. But honestly, any recurring polling is part of the problem.

Is there already a software project that tries to solve this?
 
I'm not aware of any software that can do this at present, but you can add maybe another feature to the list ... reducing CPU allocation for processes controlling windows on a desktop that are not in the foreground or visible.

I had something like that working for X11, just not found a way to make it work for Wayland yet.
 
Also interested in preventing sleep-state on lid close. As long as AC is connected and we're not overheating, stay awake, and run those power intensive tasks until they are all complete
 
Maybe switch from 5ghz to 2.4ghz wifi when on battery too if there's a difference in power usage
 
Also interested in preventing sleep-state on lid close. As long as AC is connected and we're not overheating, stay awake, and run those power intensive tasks until they are all complete
This is one I use a lot with my laptop and the wife laptop. She is a graphic designer and takes her laptop to work a lot but when she comes home she plugs it in to a Plugable usb 3.0 dual 4k and puts it on a tray and close the laptop lid. Then slides it under the desk and how has a keyboard mouse and dual monitors with speaker connected to the hub with 4 USB ports as well. The hub also hardwire to network since she has to upload some large files every now and then.
 

About Us

  • The Linux.Chat community is a multi-platform community for general Linux® support. We provide help and support for any Linux® distribution and aim to answer any questions you might have about Linux®. Discussion about the various aspects of Linux® and Free/Open Source software is also encouraged.

    Visit our communities website at Linux.Chat.
  • Linux® is the registered trademark of Linus Torvalds in the U.S. and other countries.

Quick Navigation

User Menu