Received: by 2002:a25:8b91:0:0:0:0:0 with SMTP id j17csp17786584ybl; Thu, 2 Jan 2020 12:02:27 -0800 (PST) X-Google-Smtp-Source: APXvYqz8d5eScbLjMxNbDmCPOmUf/kO3QcJk/OSu7Js0uWigrL4AVPSnm2nNOmEXLyaZeazbUUWw X-Received: by 2002:aca:570d:: with SMTP id l13mr2689720oib.146.1577995347553; Thu, 02 Jan 2020 12:02:27 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1577995347; cv=none; d=google.com; s=arc-20160816; b=z+MUKo91JJS/oPRQTECww36py/QFiUGeSzqbmBaZUV1o4wuUcHYjTTH7HnIA+Pk9qU TldKsfvvVsBX+HOtVCInrERY7naoMQy7sl0aWU/O/WoP1yRgaPS7DYc4qGnZXOejjf84 k7dKqQZF4FwSw5D2LrPMZ8S/iEafl0DYomBlczkOAxPpU702TUhaZA/e533w22UHbQO1 cyG42GrUTv73V5J1nqnxHTL1krWj7L7y5SZay0MZ7owsEvmC3TvD7iK6xbnB7K8Snltl PBejC16FsCw1gmr+GW27RbQO0AEW1XptTdDO/apyF87yRsw5Z1cISgGJd/Y8PvLWx48W 14Yg== 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=LOdRyowqBoe80Ka6aEVjecwc8pDHVEONnfygkJoJKtheP0NbvTpwpKhQarVHOUxpxX wVhVX9WmMQoBMLvCGbEy6LpgWk8/JAqi+B/kK0lozIbpmk47X9l0WeADIT811RbF+Zpu ef7+On8inGceA5DxtUdvKDq6ig3L3oYCoZOBZkT0aVvsE9RaeHeGitjV/Vz10HR751HX xvvntK+EfjurZDUXa8T7GgsXUxKt+4pjZNYTfhB0MIarHpnHMNonsxuqk6x0RucONSUT ZdOGoPNBUx2nx0J9eoDeqE0MoIwcMl9xxO0e7mmCiyIXW0p0shXvvQ8DOD+2p//1klAT 1K3A== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@google.com header.s=20161025 header.b=UdXvDjVj; 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 s5si18661085oic.116.2020.01.02.12.02.15; Thu, 02 Jan 2020 12:02:27 -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=UdXvDjVj; 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 S1728649AbgABUBM (ORCPT + 99 others); Thu, 2 Jan 2020 15:01:12 -0500 Received: from mail-pg1-f202.google.com ([209.85.215.202]:54864 "EHLO mail-pg1-f202.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728296AbgABUBL (ORCPT ); Thu, 2 Jan 2020 15:01:11 -0500 Received: by mail-pg1-f202.google.com with SMTP id i21so79861pgm.21 for ; Thu, 02 Jan 2020 12:01:11 -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=UdXvDjVjDE18h3ONKld18ZfOZW7pR3vFqqyTPrQKJToK5J6AEggZmqaRXy8sZ2CFA9 Q8hB54QeLPLclYtzAaai1ZfJ1InNNuRcXNSzEq94NIQk4I1eV7Yfb4ksENAjx5uiOAm/ lgxAzsq/u++mCnvzKcIrfqNnLhlKPlw2vR3m+DRLq2Y+aVoGusJZIHDSMKLPlmMjQuop CmhDdAZvqSd11vo2jUTfvheqNUr067u9fXcPd2Hz9FUT1z2He6rGmBy0Cvyrf0+l9DIU Jjv1ROxvJPq5vCPyj8KgwfoUAI/7nuxEo81qcSkj37JlWKgFDPo5p1/RLfSIQQOtfbJ4 x7ug== 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=nF/zszKxG7EExDEKIXI9wwDPHyUROmGQ36x+/YRBlEedY0nUSi67GPEoyb/CV8e2bu hUpnJiM5XF+dAiGB5ooe8dUduBJDJqAmg2ydAl48k451tUZMI/DJXSatMmvSSRXW8Lxv m4A4v2a3VPoYqhmI8DDOJWmpdD/DqYre4+pevdHeppemOinkd38eVce8zaLgnuictrR5 WjzI5winpR/t2yb1ECZtnhrKG/vsL5UTWiaauCZ4Itw/gv2M2NtbZFa92Pr8fxrlN79C yYauNMKHBOFAD5fM4yV/bdXFd7yT4CDpcDFVH2EwaUwkAgCI/7jpmrBnAirNccJlvTbs DS2w== X-Gm-Message-State: APjAAAU6A/t9+X/yuZrJtdgJl5cIF0KxMBIxMKfd3TUOUTPxGTh4o2oz XfjaZ7gQn+22suffbK9tPllskOWIF4diuGc= X-Received: by 2002:a63:1f0c:: with SMTP id f12mr94044751pgf.247.1577995270594; Thu, 02 Jan 2020 12:01:10 -0800 (PST) Date: Thu, 2 Jan 2020 12:00:51 -0800 In-Reply-To: <20200102200052.51182-1-semenzato@google.com> Message-Id: <20200102200052.51182-2-semenzato@google.com> Mime-Version: 1.0 References: <20200102200052.51182-1-semenzato@google.com> X-Mailer: git-send-email 2.24.1.735.g03f4e72817-goog Subject: [PATCH v2 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, 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