Ubuntu Is Working On Much Faster Hibernation/Resume Support

Written by Michael Larabel in Linux Kernel on 8 June 2020 at 03:39 PM EDT. 54 Comments
LINUX KERNEL
Canonical's Andrea Righi who is on the Ubuntu Kernel Team sent out a set of patches last week working on opportunistic memory reclaim support as a means of achieving much speedier system hibernation and resume performance.

When hibernating the system and needing to dump the entire contents of RAM to the swap/resume device, the kernel can try to free up some pages that don't need to be saved to disk where they can be easily regenerated at resume time without much overhead.

Due to the I/O involved in freeing up the system memory and writing the hibernation image to disk, this is one of the key bottlenecks but can be less so with Canonical's opportunistic memory reclaim patches. The opportunistic memory reclaim can allow user-space to trigger the memory reclaim / artificial memory pressure ahead of the actual hibernation process, such as when the system has been idle for a defined period of time and likely to be hibernated soon.

By carrying out that memory reclaim process ahead of time, the actual hibernation process is much faster as well as the resume time thanks to (ideally) having less to recover from the disk image. The request for comments patches expose new knobs via sysfs for triggering the process and a tunable for how many pages should try to be reclaimed.

While this can benefit all systems hibernating, the motivation by Canonical is focused on cloud instances that hibernate when other instances are being prioritized in its place. For being able to more quickly hibernate those instances when needed, the cloud infrastructure can respond better to changing needs/capacity.

The testing so far by Andrea Righi showed that with the opportunistic memory reclaim patches the hibernate process could drop from around 51 seconds to just 4 seconds in a default configuration or with the lowest image size going from 73 seconds to 5 seconds. In the default configuration, the resume process also sped up from 26 to 5 seconds.

For now the patches are out for review on the mailing list. It's too late for seeing the material in Linux 5.8 but hopefully could be mainlined in 5.9 if all goes well. Besides the kernel patches, in user-space you will also need to have integrated the respective triggering of this opportunistic memory reclaim after a defined idle threshold before hibernating or other policy for handling this task in advance of system hibernation.
Related News
About The Author
Michael Larabel

Michael Larabel is the principal author of Phoronix.com and founded the site in 2004 with a focus on enriching the Linux hardware experience. Michael has written more than 20,000 articles covering the state of Linux hardware support, Linux performance, graphics drivers, and other topics. Michael is also the lead developer of the Phoronix Test Suite, Phoromatic, and OpenBenchmarking.org automated benchmarking software. He can be followed via Twitter, LinkedIn, or contacted via MichaelLarabel.com.

Popular News This Week