[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <20191226220205.128664-2-semenzato@google.com>
Date: Thu, 26 Dec 2019 14:02:04 -0800
From: Luigi Semenzato <semenzato@...gle.com>
To: linux-mm@...ck.org, linux-kernel@...r.kernel.org
Cc: rafael@...nel.org, akpm@...ux-foundation.org, gpike@...gle.com,
Luigi Semenzato <semenzato@...gle.com>
Subject: [PATCH 1/2] Documentation: clarify limitations of hibernation
Entering hibernation (suspend-to-disk) will fail if the kernel
cannot allocate enough memory to create a snapshot of all pages
in use; i.e., if memory in use is over 1/2 of total RAM. This
patch makes this limitation clearer in the documentation. Without
it, users may assume that hibernation can replace suspend-to-RAM
when in fact its functionality is more limited.
Signed-off-by: Luigi Semenzato <semenzato@...gle.com>
---
Documentation/admin-guide/pm/sleep-states.rst | 18 +++++++++++++++++-
1 file changed, 17 insertions(+), 1 deletion(-)
diff --git a/Documentation/admin-guide/pm/sleep-states.rst b/Documentation/admin-guide/pm/sleep-states.rst
index cd3a28cb81f4..fd0072eb8c03 100644
--- a/Documentation/admin-guide/pm/sleep-states.rst
+++ b/Documentation/admin-guide/pm/sleep-states.rst
@@ -112,7 +112,9 @@ Hibernation
This state (also referred to as Suspend-to-Disk or STD) offers the greatest
energy savings and can be used even in the absence of low-level platform support
for system suspend. However, it requires some low-level code for resuming the
-system to be present for the underlying CPU architecture.
+system to be present for the underlying CPU architecture. Additionally, the
+current implementation can enter the hibernation state only when memory
+pressure is low (see "Limitations" below).
Hibernation is significantly different from any of the system suspend variants.
It takes three system state changes to put it into hibernation and two system
@@ -149,6 +151,20 @@ Hibernation is supported if the :c:macro:`CONFIG_HIBERNATION` kernel
configuration option is set. However, this option can only be set if support
for the given CPU architecture includes the low-level code for system resume.
+Limitations of Hibernation
+==========================
+
+When entering hibernation, the kernel tries to allocate a chunk of memory large
+enough to contain a copy of all pages in use, to use it for the system
+snapshot. If the allocation fails, the system cannot hibernate and the
+operation fails with ENOMEM. This will happen, for instance, when the total
+amount of anonymous pages (process data) exceeds 1/2 of total RAM.
+
+One possible workaround (besides terminating enough processes) is to force
+excess anonymous pages out to swap before hibernating. This can be achieved
+with memcgroups, by lowering memory usage limits with ``echo <new limit> >
+/dev/cgroup/memory/<group>/memory.mem.usage_in_bytes``. However, the latter
+operation is not guaranteed to succeed.
Basic ``sysfs`` Interfaces for System Suspend and Hibernation
=============================================================
--
2.24.1.735.g03f4e72817-goog
Powered by blists - more mailing lists