Linux – Suspend to Idle or to RAM?

In a recent post, I was quite happy to report that by and large, I had no big issue running Ubuntu 20.04 with a Linux 5.11 kernel on the latest notebook hardware in 2021 with an 11th generation Intel i5 processor. Everything except the cheap Wi-Fi card ran out of the box and there’s a fix for that Wi-Fi as well. In addition, suspend/resume worked out of the box as well, which was one of my biggest worries. A week or so later, I noticed, however, that when I unplug the computer while suspended, the battery would drain very quickly and is empty after half a day. Hm, could the power efficiency of the suspend mode be so bad on that platform?

For comparison: My Lenovo X13 draws around 25-30% in 12 hours out of the battery in suspend state. That’s a significant difference! When connecting a power meter to the power supply I saw that even in suspend, the HP notebook drew around 4 Watts. Wow!

The solution: There are actually two suspend modes: The better one, Suspend to RAM switches off pretty much everything but the RAM refresh, but requires BIOS support. And then there’s Suspend to Idle, which also powers down a lot of things but is not nearly as power efficient. You can check which type of suspend the Linux kernel uses on a notebook with the following command:

cat /sys/power/mem_sleep

# response for suspend to RAM (power efficient, better variant):

# option in bracket [] is the one selected
s2idle [deep]

# response for suspend to Idle (not as power efficient):

# option in bracket [] is the one selected
[s2idle] dee
p

And indeed, while my X13 has ‘deep‘ in brackets, the kernel on the HP notebook has selected ‘s2idle‘ as default suspend state. It’s possible to change the suspend mode by writing into mem_sleep (see here for details), so I gave it a try on the HP, which then failed to wake up properly from suspend. So the Linux kernel had a good reason to use s2idle by default.

Fortunately, this doesn’t matter much for my use case, as I prefer a faster wakeup to a deeper and more power efficient suspend state. But for a more mobile use of a notebook, a suspend power consumption of 4 watts is a bit of a problem.

In other words: When getting a new notebook, one of the first things to check is if suspend/resume works. And if it does, one should check straight away which suspend state is actually used by the kernel and if that fits the intended use case of the device!