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=-8.4 required=3.0 tests=DKIMWL_WL_MED,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI, SPF_HELO_NONE,SPF_PASS,USER_IN_DEF_DKIM_WL autolearn=no 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 001A8C2D0DB for ; Mon, 27 Jan 2020 17:21:40 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id BB75622522 for ; Mon, 27 Jan 2020 17:21:40 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=google.com header.i=@google.com header.b="hJnxUJNV" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org BB75622522 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 4A0966B0003; Mon, 27 Jan 2020 12:21:40 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id 450966B0006; Mon, 27 Jan 2020 12:21:40 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 366E36B0007; Mon, 27 Jan 2020 12:21:40 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0116.hostedemail.com [216.40.44.116]) by kanga.kvack.org (Postfix) with ESMTP id 1BA6D6B0003 for ; Mon, 27 Jan 2020 12:21:40 -0500 (EST) Received: from smtpin21.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay01.hostedemail.com (Postfix) with SMTP id B6E63180AD802 for ; Mon, 27 Jan 2020 17:21:39 +0000 (UTC) X-FDA: 76424081118.21.brass50_65c0603a72307 X-HE-Tag: brass50_65c0603a72307 X-Filterd-Recvd-Size: 5873 Received: from mail-il1-f193.google.com (mail-il1-f193.google.com [209.85.166.193]) by imf11.hostedemail.com (Postfix) with ESMTP for ; Mon, 27 Jan 2020 17:21:38 +0000 (UTC) Received: by mail-il1-f193.google.com with SMTP id i7so4939092ilr.7 for ; Mon, 27 Jan 2020 09:21:38 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20161025; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=FlVv3OiGshIByx4bdZlL96riWYmzI3zF0LMlVGex22I=; b=hJnxUJNVX5ujJFbvBapdFCAEPbl+jm/DXbMzBPzjb1o5n3mHiupGbT11C+eTMrk/eb aIaF/wk5AEY5Gy6TQOgc0YHh39SYb3mqFxK9xAEyoCVMJ3tm4yl/OgCF54m7tg379ad8 +EThVtfC4feIY2LUh2aTTCP+tMXfZe4bEpZjbi7zZDTc6S3mk3g00zF2JMnZW0XJIK7I DkV2rFDwhCKCdlX7DKJMgAMifhHjJR6YXNNGI/0vvuF8nc/lFKZu7Eh3uLW0ao+lETWW dNHxipd1PAaPeR1Mb5Zrt+22E9dcyC3udphRNJTQNJ92svPoEjN1g0E9jNCHgusMtRvk xj9w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=FlVv3OiGshIByx4bdZlL96riWYmzI3zF0LMlVGex22I=; b=Xty4i2fn21pWOkvwBnZrO6HPK1zidHEeDSqDYVK+DHP+2QdPe7GoiRnRN0zo8gJmVl wqCNYx9GABNvuJd0OHzI5vmlIInLlpXoThQiL690tTqY/bvvb4cfBGhEmdIJHghxJRlh bCvodUxLR+Y0vfmw/nXz5T56+YT4sW2lgQtl3zPh83jf4BQPqIwEIMEnVXnl6q5uhmSB L0i3ZZbp0QKZ8Gp8j+IeqnzzKQASpPZpqEE/K99OfksfkOh/yufj0qDxOouHV+YgpbxC 6WdrvQgjDla5UIIC0UQn8HhQ8fx+0/87SFNku249+02IBtLSmT8DOoVtX2ShWYeznqvQ YMzA== X-Gm-Message-State: APjAAAVAfE3zNO4nB+KE0iyD97YQwlWi43VqF3ruCaqcadSQXW1O25Ij 9lfcppNFa8meUvQju7aIQiCxlpatmvIrTp1D8U/9tg== X-Google-Smtp-Source: APXvYqyLTGq5aOlxrG7MkaZqmL6uBRSlRlJwQsi2obu0iJ2cN7wGMd3Jj1iPrdrlgmXvYTf5rfI6vBhi5oLzEXMHUS4= X-Received: by 2002:a92:d642:: with SMTP id x2mr15910283ilp.169.1580145697386; Mon, 27 Jan 2020 09:21:37 -0800 (PST) MIME-Version: 1.0 References: <20191226220205.128664-1-semenzato@google.com> <20191226220205.128664-2-semenzato@google.com> <20200106125352.GB9198@dhcp22.suse.cz> <20200108114952.GR32178@dhcp22.suse.cz> <20200127141637.GL1183@dhcp22.suse.cz> In-Reply-To: From: Luigi Semenzato Date: Mon, 27 Jan 2020 09:21:25 -0800 Message-ID: Subject: Re: [PATCH 1/2] Documentation: clarify limitations of hibernation To: "Rafael J. Wysocki" Cc: Michal Hocko , Linux Memory Management List , linux-kernel , Andrew Morton , Geoff Pike 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: On Mon, Jan 27, 2020 at 8:28 AM Rafael J. Wysocki wrote: > > On Mon, Jan 27, 2020 at 5:13 PM Luigi Semenzato wrote: > > > > On Mon, Jan 27, 2020 at 6:16 AM Michal Hocko wrote: > > > > > > On Fri 24-01-20 08:37:12, Luigi Semenzato wrote: > > > [...] > > > > The purpose of my documentation patch was to make it clearer that > > > > hibernation may fail in situations in which suspend-to-RAM works; for > > > > instance, when there is no swap, and anonymous pages are over 50% of > > > > total RAM. I will send a new version of the patch which hopefully > > > > makes this clearer. > > > > > > I was under impression that s2disk is pretty much impossible without any > > > swap. > > > > I am not sure what you mean by "swap" here. S2disk needs a swap > > partition for storing the image, but that partition is not used for > > regular swap. > > That's not correct. > > The swap partition (or file) used by s2disk needs to be made active > before it can use it and the mm subsystem is also able to use it for > regular swap then. OK---I had this wrong, thanks. > > If there is no swap, but more than 50% of RAM is free > > or reclaimable, s2disk works fine. If anonymous is more than 50%, > > hibernation can still work, but swap needs to be set up (in addition > > to the space for the hibernation image). The setup is not obvious and > > I don't think that the documentation is clear on this. > > Well, the entire contents of RAM must be preserved, this way or > another, during hibernation. That should be totally obvious to anyone > using it really. Yes, that's obvious. > Some of the RAM contents is copies of data already there in the > filesystems on persistent storage and that does not need to be saved > again. Everything else must be saved and s2disk (and Linux > hibernation in general) uses active swap space to save these things. > This implies that in order to hibernate the system, you generally need > the amount of swap space equal to the size of RAM minus the size of > files mapped into memory. > > So, to be on the safe side, the total amount of swap space to be used > for hibernation needs to match the size of RAM (even though > realistically it may be smaller than that in the majority of cases). This all makes sense, but we do this: -- add resume=/dev/sdc to the command line -- attach a disk (/dev/sdc) with size equal to RAM -- mkswap /dev/sdc -- swapon /dev/sdc -- echo disk > /sys/power/state and the last operation fails with ENOMEM. Are we doing something wrong? Are we hitting some other mm bug? Thanks!