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=-1.0 required=3.0 tests=MAILING_LIST_MULTI, SPF_HELO_NONE,SPF_PASS 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 F15FDC35240 for ; Thu, 30 Jan 2020 20:50:14 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id 9B0FC214AF for ; Thu, 30 Jan 2020 20:50:14 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 9B0FC214AF Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=kernel.org Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=owner-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix) id 0AB5B6B0384; Thu, 30 Jan 2020 15:50:14 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id 059F66B0385; Thu, 30 Jan 2020 15:50:13 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id E8CA86B0386; Thu, 30 Jan 2020 15:50:13 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0234.hostedemail.com [216.40.44.234]) by kanga.kvack.org (Postfix) with ESMTP id D17586B0384 for ; Thu, 30 Jan 2020 15:50:13 -0500 (EST) Received: from smtpin26.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay02.hostedemail.com (Postfix) with ESMTP id 956154995EF for ; Thu, 30 Jan 2020 20:50:13 +0000 (UTC) X-FDA: 76435493106.26.sack43_3c2478cd65441 X-HE-Tag: sack43_3c2478cd65441 X-Filterd-Recvd-Size: 5738 Received: from mail-oi1-f196.google.com (mail-oi1-f196.google.com [209.85.167.196]) by imf14.hostedemail.com (Postfix) with ESMTP for ; Thu, 30 Jan 2020 20:50:13 +0000 (UTC) Received: by mail-oi1-f196.google.com with SMTP id z2so5023747oih.6 for ; Thu, 30 Jan 2020 12:50:13 -0800 (PST) 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=Z08RuybXoEe11iM07MN6xxLwPZjJpKeFz19KOn5eV6I=; b=XxsJ/pNISr5DOXRmaJBNYc1T4pL59wq7Dw2cl9v0ZxAg6B2uMzf9c9EXo2NI/VwKE1 Pg/JCzrznCF9vwrLi2OG5AtYYfj3RtRzhWaLV1iKMtgZzm/lgyWUkEA9p736wf1/X9CK jJZb7v3jM02RVhAUeZFhLoRMZD1phiQI7ybGPBexEeUOR3S80cx9Lz5K4Svhg4ACW0mS EKsQoGKPlXjh8eejfQMRThL3b7AJqsx6VlGeza8IauwH5k6550w3FOf6iAqqn7x0LtqH FIM7569FTJX6cp/whjdkvHy2bBbypmkje/t15JSl+Qy3GrD6rculhe7TIZUnv+/qy2LC AT1w== X-Gm-Message-State: APjAAAXIk8UAcsLfHNcbFZuXfJK+t2ZvCbYh+zg67rLzgu4+otPuuqts fh3UIVVNwS5t8RTc0KnYirUtkLQRS90BHKffuVE= X-Google-Smtp-Source: APXvYqxhvR32zpaQQHSAuKUvzAmU5Z/UEzC5dQVq3xkECvKrwDvLK4GU/XaYkAjmz0/3jkCxe0yvMUuLrDpz/HXAcCE= X-Received: by 2002:aca:d6c8:: with SMTP id n191mr4314332oig.103.1580417412327; Thu, 30 Jan 2020 12:50:12 -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: "Rafael J. Wysocki" Date: Thu, 30 Jan 2020 21:50:00 +0100 Message-ID: Subject: Re: [PATCH 1/2] Documentation: clarify limitations of hibernation To: Luigi Semenzato Cc: "Rafael J. Wysocki" , 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 6:21 PM Luigi Semenzato wrote: > > 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? I would expect this to work, so the fact that it doesn't work for you indicates a bug somewhere or at least an assumption that doesn't hold. Can you please remind me what you do to trigger the unexpected behavior?