Received: by 2002:a25:8b91:0:0:0:0:0 with SMTP id j17csp17946516ybl; Thu, 2 Jan 2020 15:21:33 -0800 (PST) X-Google-Smtp-Source: APXvYqxwtemZKmheOyiEclVSoSHcEMo1MQM7NmZ+BkPQrc2C99hQnzKdXncnCZzzYQHN3sw+5CFk X-Received: by 2002:aca:60c3:: with SMTP id u186mr3336073oib.163.1578007293310; Thu, 02 Jan 2020 15:21:33 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1578007293; cv=none; d=google.com; s=arc-20160816; b=i6vsmwcMW+9OvOYN4NLYfpx3WQBXatTMuHCGQRxWAVkqsuFyDFVc+RcXXGcauGDQjx hy49hHJhTWawKS3vLPAUXihpP+Cv1sndoJGJBuDlIzndiD6V/st71jngmujpDK5S5rYg 2tkDHMLWJ9hnR1DbdM9tQX7P0iowqJamBXKKPvKIM90plM8rVSUhmU8UwBTlv/vb3+ge dhTeN1/K9zeN6M92kxgwY5tKQHihXJDozrdCxRFsaHcG5YrcbNT6qnGC6JH2bo0r8ZDR t7TJhRztNmzmYWS8dQ5Sj55/U2zMCFU5xzS3tK9XzxF+ppIahb0kfjabY9apVqafxmgu cZkw== 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=kVgpbfrdFyyzSYGGFbgXSziUKzTWcn4XrnhMtwS4vPA=; b=KbC17/8RqE8D7irvQ1ZgTulSb9Ce5Gwp1F5NulhG4dEL3+gHV4EdQIREPI+EYHzbyt 3tLA9fZ0cmkfmRk8aS87KUcCYb+xmfukWgJ1clKzD4PT/ZVTIWpMpwRmCjojuMJo1rk8 vxIogLrur0csWKKUe6j/0odHHG5dOMNKS/W1W25tJUs8VXRh6U6fJH2VGB6YBl1j0LAu YdMWM7DdFJiasiPnxrwWetbQTfF/Zv5tdr7thdOTdZ/2FOVXhH20vB2uQWUIc48sXUUX DV8rhHgklGsqKfJNLPTHZ96S+ncnn6vHFRGkEuyDmuKSBIInR4K/fOMgsKd4n1pc++tx 1vuA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@google.com header.s=20161025 header.b=naNXRzqP; 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 l84si26271029oig.5.2020.01.02.15.21.21; Thu, 02 Jan 2020 15:21:33 -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=naNXRzqP; 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 S1727036AbgABXTv (ORCPT + 99 others); Thu, 2 Jan 2020 18:19:51 -0500 Received: from mail-vk1-f201.google.com ([209.85.221.201]:47167 "EHLO mail-vk1-f201.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726194AbgABXTv (ORCPT ); Thu, 2 Jan 2020 18:19:51 -0500 Received: by mail-vk1-f201.google.com with SMTP id n9so16697601vkc.14 for ; Thu, 02 Jan 2020 15:19:49 -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=kVgpbfrdFyyzSYGGFbgXSziUKzTWcn4XrnhMtwS4vPA=; b=naNXRzqP4eq5jR2xonGKtj51+vylv6Yying5ZawbfOW3zs+5KFwQXlWSsu45RITUOr hxF65GnQA5prSB4shmGn8eypDxfWnMtXSpfnY7fq/YTHasOG5rcp1pZvHgFp9kyZePW9 XjnC2fB4OhAoqmbqMi6hxzKPF+LjhZ6UkHEFVI5TDPzeUnC/63LjlGVH5QOijFDuUuDQ eZ8UOGuj1z4gd/05QxPOz1q0bXQYYlLr4S5q86VzpSKjPEdIBX3xj+B2fBmL22HeKoKw V+lzL5DPvlv3gmHuFBWN6vLdTypMG7l9/YB4NPXEecVFNzHcK++BQa24wenyni3CcxCw QxAQ== 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=kVgpbfrdFyyzSYGGFbgXSziUKzTWcn4XrnhMtwS4vPA=; b=hFKDmhQtxDPw9JLAw9zO0jBmUkUzyaMr6Oy1XTUPk62219JMTh6ryqV82DbqkcmA64 6OFFIso9tglaT/7nPOxkaneh+JGPSkfPuLwVJbyelKkBYUhTAlieUVU2YudGK7gtONFI ryRf053GQML564ZLnSU+cCMCL1t47MFnbNI/kd/UaXEirPxK5FTZVZcsGrvXxRxBf/DG tZQpQ46OokqOKJBrtKdks1uX+8di6WGKQ0jhVK2zsUKlPHH+kGcy57Y7RYONSPIQVOeK 99qvpUpNPQWFoSSmh/8tS6cKDTS67pKsYzpjdKLojn7uD47dlAZ0fKdie/pVYsxcovXa pHQQ== X-Gm-Message-State: APjAAAWpnF2/XqdqHjXBzbz8ZbETMN6lfrET7fRsJunNNXZDNtIXwwWF WXOE+uFWKVAb4gQ2y1vxLs3RFh2PSLlGkno= X-Received: by 2002:ab0:710c:: with SMTP id x12mr46193205uan.81.1578007188489; Thu, 02 Jan 2020 15:19:48 -0800 (PST) Date: Thu, 2 Jan 2020 15:19:39 -0800 In-Reply-To: <20200102231940.202896-1-semenzato@google.com> Message-Id: <20200102231940.202896-2-semenzato@google.com> Mime-Version: 1.0 References: <20200102231940.202896-1-semenzato@google.com> X-Mailer: git-send-email 2.24.1.735.g03f4e72817-goog Subject: [PATCH v3 1/2] Documentation: clarify limitations of hibernation From: Luigi Semenzato To: linux-pm@vger.kernel.org Cc: linux-kernel@vger.kernel.org, linux-mm@kvack.org, akpm@linux-foundation.org, rafael@kernel.org, gpike@google.com, elliott@hpe.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 | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/Documentation/admin-guide/pm/sleep-states.rst b/Documentation/admin-guide/pm/sleep-states.rst index cd3a28cb81f4..a2d5632b7856 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 +usage is sufficiently 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,14 @@ 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. Basic ``sysfs`` Interfaces for System Suspend and Hibernation ============================================================= -- 2.24.1.735.g03f4e72817-goog