Canonical offers patches to speed up sleep mode activation

Canonical developers released via a Linux kernel development mailing list, a set of patches for the implementation of opportunistic memory cleaning, which aims to significantly reduce time in sleep mode of the System.

Optimization is achieved by proactively invoking the release of memory structures children that do not contain unique information and that can be dynamically restored after returning from sleep mode (for example, anonymous memory areas and multiple memory page caches).

About the patches

The main idea is that after deleting unnecessary data, memory image size is reduced to saver before going to sleep mode and consequently less time is required to write and read from a slow medium.

Default, when saving a memory dump for sleep mode, the kernel saves memory how is it with all caches, But there is a standard possibility of releasing Unnecessary structures simulating insufficient resource conditions in the initial stage of transition to sleep mode.

This feature can be activated using the parameter "/ sys / power / image_size" and leads to a noticeable reduction in the time to go to sleep mode.

Canonical suggests adding two more parameters, which will allow the release of unnecessary structures in advance so that the actual transition to sleep mode is completed as quickly as possible and returning from sleep mode took about the same amount of time as when the parameter is applied.

Tests and results

Testing on a system with 8 GB of RAM and an 8 GB swap partition while using 85% of memory showed in default settings (image_size = default) a decrease in time to go to sleep mode of 51.56 to 4.19 seconds when the excess memory cleanup process started 60 seconds before switching to sleep mode.

Due to the reduction in the size of the saved memory image, the recovery time decreased from 26.34 to 5 seconds.

Here is the first attempt to provide an interface that allows user space tasks to trigger opportunistic memory reclamation before hibernating a system.

Recalling memory in advance (e.g., when the system is idle) allows
reduce the size of the hibernation image and significantly speed up the hibernation and resume time.

When normal cleaning mode for excess memory (image_size = 0) was enabled on the system, the time to go to sleep mode decreased from 73.22 to 5.36 seconds and the time to return from sleep mode did not change (decreased only by a fraction of a second, from 5.32 to 5.26 seconds).

The typical use case for this feature is to allow high-priority cloud instances to overtake low-priority instances (for example, spot instances [1]) by hibernating them.

Opportunistic memory reclamation is very effective in quickly hibernating instances that allocate a large amount of memory and remain mostly idle most of the time, using only a minimal working set.

Use

The proposed method can be requested in situations where it is necessary to go quickly to sleep mode and the need for such a transition can be anticipated in advance.

For example, in cloud systems, low-priority virtual environments (point environments in Amazon EC2) can dynamically go into hibernation and free up occupied memory as consumption of primary resources grows.

When the load is reduced in primary settings, low priority environments return from sleep mode. In these conditions, to maintain adequate quality of service, it is important to minimize the time to enter and exit sleep mode.

The preventive cleaning phase can begin when a certain level of the main load is reached, which precedes the level that leads to freezing of low priority environments.

Source: https://lkml.org


Leave a Comment

Your email address will not be published. Required fields are marked with *

*

*

  1. Responsible for the data: Miguel Ángel Gatón
  2. Purpose of the data: Control SPAM, comment management.
  3. Legitimation: Your consent
  4. Communication of the data: The data will not be communicated to third parties except by legal obligation.
  5. Data storage: Database hosted by Occentus Networks (EU)
  6. Rights: At any time you can limit, recover and delete your information.