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 13B76C2D0C3 for ; Fri, 27 Dec 2019 21:34:59 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id C6A7620828 for ; Fri, 27 Dec 2019 21:34:58 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=google.com header.i=@google.com header.b="RdNZMciD" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org C6A7620828 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 659108E0006; Fri, 27 Dec 2019 16:34:58 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id 60AA68E0001; Fri, 27 Dec 2019 16:34:58 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 547378E0006; Fri, 27 Dec 2019 16:34:58 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0069.hostedemail.com [216.40.44.69]) by kanga.kvack.org (Postfix) with ESMTP id 411048E0001 for ; Fri, 27 Dec 2019 16:34:58 -0500 (EST) Received: from smtpin13.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay02.hostedemail.com (Postfix) with SMTP id 072CE440F for ; Fri, 27 Dec 2019 21:34:58 +0000 (UTC) X-FDA: 76312226676.13.curve41_486a0a9563a1d X-HE-Tag: curve41_486a0a9563a1d X-Filterd-Recvd-Size: 5387 Received: from mail-pf1-f201.google.com (mail-pf1-f201.google.com [209.85.210.201]) by imf40.hostedemail.com (Postfix) with ESMTP for ; Fri, 27 Dec 2019 21:34:57 +0000 (UTC) Received: by mail-pf1-f201.google.com with SMTP id h16so2621246pfn.23 for ; Fri, 27 Dec 2019 13:34:57 -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=RdNZMciDLFgKkyIDaWhT6WxaY3TDLqkBDp2Ixji0JySrGMBp513vlcLstosZ8RvBRR j1LrNBruCzrRMDRTfWaThe42d4iqZ4MU6vydR5NGYkM6aSlZdmGt8q2JhLGT5t9vNdAn /JeiFnpT5wPoILa/yYaq2sZQ2bZ9znxdLE+a0hr9zf4M6ZygEOoqt3Rj0pMryh2nVd/q It1zEUTUdcJNW0Jk+JrXrWdy+wmE8p2GmEPb+2np4H+66iF7NkAB9mzagjnffVoLywxw 3c3By9+xJijfdpziDK9D/Ypv9eBgtCD0lKQxWWna5I3uX7b3TFExphhzG4NtnVylpGaW io9A== 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=F1AuGn8aR5Ienx6aqhtNRubRJTC/KkwHv180APoS9Q50bDHTIL7QKBIPC8MvrmyxzF 4jSGfRvSFXlXQbbIoFzeR3/3/QTRom++56y8TaAybuDQhovw9Fa7OH6/7U3UldxKuy7S Af81EZ8F8sknzsE+pipADpSGGdHAHmr4npalFtbmWl4ujRL5iXLPxtDSnOAvvF8SuWDA 3rzEPKeyFr611J3uHgM1qiebYodzTFK254ljXA0kTdc5vTgDdK9O2g3vVrjw1Nn0Z3C9 LOk2G/3iNtL03nUfwfTwQKMWTJZz7DdMh28rB471sY684pupNzNRj/KQWw9jAiIYFWp7 hD+Q== X-Gm-Message-State: APjAAAUbZy48lZT3T4IBMFadwbF7E+43F35kThyP3MQfC4Vso2c9uaA/ qr1O4gJHPwn2wMJUsM5zHyBAbtvfr9g6q7WosWczLAhVoE8W5uUadDga8+NvuUrtqgjAGlF4x8z mAMctwSjpxo4GMXZshu+cVUbt0kcVHg113rLSIg7IqWb8JvzrpI0SH2SWgGG5rlRN X-Google-Smtp-Source: APXvYqyoinqDL5NfWZqeujQYy8Dx2OP/Vyrzgs5Evpo2qyHJ+41x1h8TICOCWSo3wP5vzNZ7gw1IXQL4YEkobZs= X-Received: by 2002:a63:f643:: with SMTP id u3mr54310405pgj.291.1577482496301; Fri, 27 Dec 2019 13:34:56 -0800 (PST) Date: Fri, 27 Dec 2019 13:34:38 -0800 In-Reply-To: <20191227213439.139123-1-semenzato@google.com> Message-Id: <20191227213439.139123-2-semenzato@google.com> Mime-Version: 1.0 References: <20191227213439.139123-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 Cc: 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 | 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