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 94CC7C2D0C0 for ; Thu, 26 Dec 2019 22:02:23 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id 4FFF42080D for ; Thu, 26 Dec 2019 22:02:23 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=google.com header.i=@google.com header.b="lBwFBgYC" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 4FFF42080D 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 0697F8E0006; Thu, 26 Dec 2019 17:02:23 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id 01A248E0001; Thu, 26 Dec 2019 17:02:22 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id E99B88E0006; Thu, 26 Dec 2019 17:02:22 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0037.hostedemail.com [216.40.44.37]) by kanga.kvack.org (Postfix) with ESMTP id D36F38E0001 for ; Thu, 26 Dec 2019 17:02:22 -0500 (EST) Received: from smtpin16.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay02.hostedemail.com (Postfix) with SMTP id 875712C07 for ; Thu, 26 Dec 2019 22:02:22 +0000 (UTC) X-FDA: 76308666924.16.day67_6bfaf961dfe01 X-HE-Tag: day67_6bfaf961dfe01 X-Filterd-Recvd-Size: 5484 Received: from mail-pl1-f201.google.com (mail-pl1-f201.google.com [209.85.214.201]) by imf05.hostedemail.com (Postfix) with ESMTP for ; Thu, 26 Dec 2019 22:02:21 +0000 (UTC) Received: by mail-pl1-f201.google.com with SMTP id q12so3861881plr.13 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=pn2+J4R2FzBD0s8pR+LtzVU54wkq+kT6NMZNMRw3Zp40LugA0Mf9Ae4crSVZ7FKoMU wHydrQlSdyxNaBKO0yt9btSwwtdR/wdr4O+evQQG4lUW5ytzjgDIBTmm1/X424VorqgN M3QSNbtuCfDiwAV+xcuY5FBzsKYwWGSUp1Wk+qItZdPEbLNh3UJKN5VpI7n7Z6MgUYcs b3ar8gMwScudCnWcPv9wBEyXvAXREQTsfLCfm1nndtAY82aRwW2zcwtLU9p38LYKF3Om /9gz2mvw3f6gibuEm1nX261nUJgwQEY24z3sr6JKsMNV9j1gZ1uHmKapbMJTHoHqY+wY 3Yqw== X-Gm-Message-State: APjAAAUCrPchAdXDXo7yH2vkf7kcq9tLOwZGlVMnH5xKMrpcSlGdoV+g 0OnPPJmvYxcVW/gm8lPIJLcPZSh6vBNpKLr7VKup4sgEb5SkbT/f+g1P3CFJwMo3HBWKY1h+PSv om3+4tiy6xOVQ7UJgADfzWRrjE9yYSGDwEcejs29MI/Se53EncLgWaUs9XNlD5tEo X-Google-Smtp-Source: APXvYqyoOERJqnNs8xqN0U8/4BTUdj3ldFp/RDVDcgJwGutNT5106xeO7hnDXIEnut75JzjeuURqDM0y8cKo+RM= 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" 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