Received: by 2002:a25:8b91:0:0:0:0:0 with SMTP id j17csp10259704ybl; Thu, 26 Dec 2019 14:04:15 -0800 (PST) X-Google-Smtp-Source: APXvYqwywqBZa82DThXMQeYFbyQOAEValqevg+rNDg5SGEcrs3yQh7jbop9i6VoSR3kA5pyDkk13 X-Received: by 2002:a05:6830:1294:: with SMTP id z20mr51289905otp.60.1577397855576; Thu, 26 Dec 2019 14:04:15 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1577397855; cv=none; d=google.com; s=arc-20160816; b=rWAp6wDInhnSYSdJ409ESdoW5weyJoKTooP3CnkJKfb4g9PDPo8rp20ndPuMKGnDfS SHNoxBdIM1zfKVN4D5ls4sp0DZ3rju91FPSY/p2P0bbjjBbZpLAyrNEgid1w0dGOdJY/ wAkZEfRjEhZw7RhlPTU9KBiLs6Qi9ne6QQ0Yo706gpPJZJS2WJfbB6lXQtpPmVbv4duA By67RzWalwEUcE1Me5ZJS3/KsjoHadv1Qjd4GB84gkeaeiwwf89Eg73qSVGBw52uqiQ9 LUH5I/1kYbaet9/5Fskm1qiDypL73Tc2nORtzHOkPDEdhB2Uu+V9lQfP3/MLz8SDvDTP P2iw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:cc:to:from:subject:references :mime-version:message-id:in-reply-to:date:dkim-signature; bh=ZxaT1ejKkfEiSvkWCbdUpX7avE1ATSBJk0Dhet6KAck=; b=Vu3h12kaA09Tul2yMuVveC/zWE5V9/+x8vlLrDNxUe1Ui6CNg+5GS3YaCbWblvKu7+ hloiVbvMwmbK8xJrhbwIS5O9tn/BhlmczAvJAbt9QPYMFjLBYYhGgr8S+E+YG0KnEj/9 TeQhOOCkf6fkPdsVM0v3uXwfCHZ2r/AVtCMOMHc7y5WfAzCs6kQRgCn3MrZTp7caPvD0 VjrhS1Dl08CDjJXYsnTAomCJS0fBTHfy6paX+HuKAJ3oUwET73OWcKSgLTypnlpvzbZ6 4JyELUrUglMledsIrC+xY5CttTqUPdMolzsjGYAImuWCP3pk3ZIl1OBUWLCirymep3qv SJAA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@google.com header.s=20161025 header.b=lBwFBgYC; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=google.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id f4si9541588oij.133.2019.12.26.14.04.03; Thu, 26 Dec 2019 14:04:15 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@google.com header.s=20161025 header.b=lBwFBgYC; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=google.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727005AbfLZWCX (ORCPT + 99 others); Thu, 26 Dec 2019 17:02:23 -0500 Received: from mail-pj1-f73.google.com ([209.85.216.73]:60236 "EHLO mail-pj1-f73.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726277AbfLZWCW (ORCPT ); Thu, 26 Dec 2019 17:02:22 -0500 Received: by mail-pj1-f73.google.com with SMTP id s19so6021442pjp.9 for ; Thu, 26 Dec 2019 14:02:21 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20161025; h=date:in-reply-to:message-id:mime-version:references:subject:from:to :cc; bh=ZxaT1ejKkfEiSvkWCbdUpX7avE1ATSBJk0Dhet6KAck=; b=lBwFBgYCbPHUBi8Pc/xTG88po2tdDR6XBwLJA5MsdXnApKzDoi1GjbjP/KfZU83wJS jpMW1ZQ9RDSNHiBBcUfs3RYp4ODJHlZklPoAH0o23ql8OwPyQnxGDMp9peydg6urfQPz lpJFJ30dgt6WSJqAz10Bmqt3QNZ+/Nx25iTlwA5rRZYv5+/0E7GZDQTs/6ClbVGEYF4O 0RFGlpWsQIxIqcw8LfFI/YTNSOKwxHVYQJmH6d9LXJsB4HanNSgQAw2Vnma+mCc1qr3x wmeFfjAuXUmo4xp5lUu84o48mQbO+AnBvstgJaYKuKDEwrIOIhNcNxD05rkLojdhzRBM CSiw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:in-reply-to:message-id:mime-version :references:subject:from:to:cc; bh=ZxaT1ejKkfEiSvkWCbdUpX7avE1ATSBJk0Dhet6KAck=; b=OBBgpxejCcb/kEXxbfJS9vNZO0BduzkzCnRzU7h4AoKuB9cgZ+OeRyWRS5uYpK589x 0SDEPlXrbzl22zhwzTZw7qrs8EVdy//sXpj0YGkFedvUO4UqcvlIpkiTpbm/pnQH0mXP u8yg0Df6ktWGm5R53JSRk1FVf8WNDENlX1akIio3YNQO8CiYQhD3oJRzGPNewXNfu6AW oCne8Q54q+/KoI3CUdKmN+HQKS17Vjc/Xalobv9aKkylNd0flWqY2phAZg6QseB6nx+n hegArPXKSnSoorcvqnbxHUT67WBUsuELJXKzhFc7JHJzYoF9prcgMae1SS9f72A3lE/V WZuA== X-Gm-Message-State: APjAAAXT0QStehS66De2IS9TthwURuzbM+QkIOScF+lwIMztYASn72N7 zSok4lxz65ndM15tvCPgPnpOVVPwivmIE5I= X-Received: by 2002:a63:fe50:: with SMTP id x16mr33100629pgj.31.1577397740721; Thu, 26 Dec 2019 14:02:20 -0800 (PST) Date: Thu, 26 Dec 2019 14:02:04 -0800 In-Reply-To: <20191226220205.128664-1-semenzato@google.com> Message-Id: <20191226220205.128664-2-semenzato@google.com> Mime-Version: 1.0 References: <20191226220205.128664-1-semenzato@google.com> X-Mailer: git-send-email 2.24.1.735.g03f4e72817-goog Subject: [PATCH 1/2] Documentation: clarify limitations of hibernation From: Luigi Semenzato To: linux-mm@kvack.org, linux-kernel@vger.kernel.org Cc: rafael@kernel.org, akpm@linux-foundation.org, gpike@google.com, Luigi Semenzato Content-Type: text/plain; charset="UTF-8" Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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 --- 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 > +/dev/cgroup/memory//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