Optimising kernel for battery life

Does it make sense to have a separate kernel optimized for battery life.

GaliumOS as improved battery life, which is achieved by removing Intel p-state driver, watchdog timer, and DRM polling.

So I ask all the kernel experts, what else can be done to achieve better battery life at a kernel level without cripling functionality.

1 Like

Have you seen this topic?

The ISO which they developed for the Bladebook or the Spitfire (I don't remember anymore) was XFCE with a CPU governor applet which was set to powersave when on battery power. What else they did in regards to the kernel, I don't know.

1 Like

That's tricky because each hardware generation has different flag capabilities. With the bladebook example at least it was one particular system rather than targeting all available laptop hardware.

The manjaro kernel has a lot of the Clear Linux tweaks apparently, couple that with @FadeMind's topic about power setup and I have always got better battery life with manjaro than any other distribution I've tried on my notebook (including Windows it came with). The savings are also not extreme enough to throttle performance too much, yes it can be noticeable if I open a shed load of browser tabs but being sensible and you really can't tell too much that the performance is capped on battery. Video streams normally, there's no stuttering and the same applies for DVD movies.

With the current larger capacity battery I can get 7 hours maximum out of the laptop, the old one at 100% health lasted 5-6 hours too. Obviously no discrete GPU involved but this is on a 2014 laptop (Fujitsu Lifebook A512) with an i3-3110m which compared to the current Core processor line up is power hungry. The only change to the standard specification I made was installing an SSD instead of the obligatory WD Blue 5400rpm HDD but that too was done in 2014. I did upgrade the RAM to 16GB but that should in theory increase power consumption versus the 4GB it came with.

1 Like

Honestly, I think you get a pretty good battery life with a proper TLP configuration. Having a kernel optimized for battery life can impact the performance when connected to the power source. I'm not willing to give up in-power performance in favor of a few minutes more of battery life.

Besides the TLP config, I also have turbo boost turned off while on battery and a slightly lower x86_energy_perf_policy.

It's hard for me to measure battery life because my battery is highly degraded (around 35% capacity).

3 Likes

This.
TLP can handle the most important aspects of powersaving, on the kernel side there is not much that can be improved further, since the kernel config is already (slightly) tuned towards battery life.

2 Likes

What could be a cool Science Fiction idea is that you can switch the kernel without rebooting.

Not science fiction, have a look at kexec.

1 Like

Thanks!
Have you tried it?
Does it take long to switch?
Would it be possible to implement an automatic switch to a "powersave" kernel when you unplug the power cable?
Of course, it would only make sense to implement if power saving in kernel were more efficient than in userspace with TLP or with a custom CPU governor switcher.

1 Like

No, not yet.

I think it's possible but probably not trivial.

They could just as well have Cleanlinux' p_state patch applied instead of removing it?
Watchdog timers can be disabled on boot.

To be honest, I would rather see a kernel geared towards performance, because as I wrote above, the kernel already is slightly biased towards powersaving.

2 Likes

well i am totally against any power saving features.
its like a parasite.
intentionally crippling system.
but again everyone has different usecases.
just for slight battery backup you reduce speed.
so it all gets equaled so.
anyway.

Well, if you can turn them on and off at will (even rebooting shouldn't be too much of an inconvenience), they could be quite useful.

Kexec looks like something that could work, for this use case, But i still need to do some more research about what else can be disabled, because if we not having big battery savings then its not worth doing, testing battery is also something that is hard to measure.

I also found this:
https://fedoraproject.org/wiki/Changes/ImprovedLaptopBatteryLife

1 Like

You could tune the CFS scheduler a bit, and use a lower tick frequency, but I doubt that it will make a noticeable difference in terms of powersaving, instead hampering reactivity/latency.
I also think that kernel-based power saving measures work out differently on AMD and Intel, and lot depends on ACPI implementation of the hardware.

And it would probably also involve a lot of monitoring and debugging, for example checking number of CPU wakeups (e.g. perf sched).

My suggestion - and much easier to put into practice, assemble a list of powersaving measures to be used with sysctl, either in /etc/sysctl.d or via a tmpfile in /etc/tmpfiles.d.

But - and it's a big but - TLP should handle most of those already...

I admire your hands-on attitude! :heart_eyes:

Battery life is another word for power consumption.
Fedora dev proposes to use powertop and actually run the laptop on battery power.
But I would suggest to use the same settings for AC power and test power consumption on AC power. It seems to me more precise to use a real wattmeter instead of powertop. But it will be cheaper than ruinig the laptop battery.

1 Like

Forum kindly sponsored by