From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-17.4 required=3.0 tests=DKIMWL_WL_MED,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_PATCH, MAILING_LIST_MULTI,SIGNED_OFF_BY,SPF_HELO_NONE,SPF_PASS,USER_AGENT_GIT, USER_IN_DEF_DKIM_WL autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id C3230C3276C for ; Thu, 2 Jan 2020 23:19:50 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id 8612121835 for ; Thu, 2 Jan 2020 23:19:50 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=google.com header.i=@google.com header.b="naNXRzqP" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 8612121835 Authentication-Results: mail.kernel.org; dmarc=fail (p=reject dis=none) header.from=google.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=owner-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix) id 28C498E0006; Thu, 2 Jan 2020 18:19:50 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id 23E268E0003; Thu, 2 Jan 2020 18:19:50 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 153DD8E0006; Thu, 2 Jan 2020 18:19:50 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0222.hostedemail.com [216.40.44.222]) by kanga.kvack.org (Postfix) with ESMTP id 00F338E0003 for ; Thu, 2 Jan 2020 18:19:49 -0500 (EST) Received: from smtpin01.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay04.hostedemail.com (Postfix) with ESMTP id 91C0C2C88 for ; Thu, 2 Jan 2020 23:19:49 +0000 (UTC) X-FDA: 76334263698.01.birth43_1b89bc01f972f X-HE-Tag: birth43_1b89bc01f972f X-Filterd-Recvd-Size: 5072 Received: from mail-vk1-f202.google.com (mail-vk1-f202.google.com [209.85.221.202]) by imf20.hostedemail.com (Postfix) with ESMTP for ; Thu, 2 Jan 2020 23:19:49 +0000 (UTC) Received: by mail-vk1-f202.google.com with SMTP id s4so16079004vkk.7 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=ntPmde+Pco69WIT2AHdRQFyuCOI2TqZeWp5r5t7mBehkQ1Jj02RZTKpS1VYzhWnBLW 2eowHSlzXLWVp7DCJ7GR0kmifp9xKYY8E+Z349TyggMx+44BGgvaHIXqzbrJFjx5TfWi gzcrl99oci/IT9AMefVhJv3IVQSTT+5LmhNDi9V1v3+0LoqThjgP/G9JlIMHSCNO+78H c8p8H0nhh0H/aFcI7kkgeg645Gn/CbUSoWq8IqmEAmhPVOpWiHk645/LEpsA+ZLJRKC7 3EObtNHd3Q/L/4mFEB7IH8usgBQsF+NVjNlLthRLVdMI/wXJN0tUcvwVhQJybGM6ihWi hJkw== X-Gm-Message-State: APjAAAW5gCu1TlC1bdCWhIPnM4HMwi7/qBB/XtMG3xDp8BKf/T59xE4z rm3w/GYPCGOXS9S6lcXmFoSsop1HIN6ESfU= X-Google-Smtp-Source: APXvYqxa6DqUBLbiprpmN9WvlFsjMhuvZ5hJC9bKtp8oHiV7FMhRzq9iAsR99Wzf38lUxiphVOaeWsgBVWL4+rk= 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" X-Bogosity: Ham, tests=bogofilter, spamicity=0.000000, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: 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