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=-10.3 required=3.0 tests=BAYES_00, HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER,MAILING_LIST_MULTI, SPF_HELO_NONE,SPF_PASS,USER_AGENT_SANE_1 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 73660C11F67 for ; Thu, 1 Jul 2021 20:02:59 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id 0FE3F6138C for ; Thu, 1 Jul 2021 20:02:59 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 0FE3F6138C Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=ucw.cz Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=owner-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix) id 4C62F8D02B4; Thu, 1 Jul 2021 16:02:58 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 4763E8D0001; Thu, 1 Jul 2021 16:02:58 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 33F168D02B4; Thu, 1 Jul 2021 16:02:58 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0083.hostedemail.com [216.40.44.83]) by kanga.kvack.org (Postfix) with ESMTP id 11F1E8D0001 for ; Thu, 1 Jul 2021 16:02:58 -0400 (EDT) Received: from smtpin03.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay04.hostedemail.com (Postfix) with ESMTP id C9EA92848E for ; Thu, 1 Jul 2021 20:02:57 +0000 (UTC) X-FDA: 78315092394.03.D5A369C Received: from jabberwock.ucw.cz (jabberwock.ucw.cz [46.255.230.98]) by imf03.hostedemail.com (Postfix) with ESMTP id 35CA230000B1 for ; Thu, 1 Jul 2021 20:02:57 +0000 (UTC) Received: by jabberwock.ucw.cz (Postfix, from userid 1017) id B26511C0B7F; Thu, 1 Jul 2021 22:02:54 +0200 (CEST) Date: Thu, 1 Jul 2021 22:02:53 +0200 From: Pavel Machek To: Evan Green Cc: Andrew Morton , Alex Shi , Alistair Popple , David Hildenbrand , Jens Axboe , Johannes Weiner , Joonsoo Kim , "Matthew Wilcox (Oracle)" , Miaohe Lin , Minchan Kim , Stephen Rothwell , Vlastimil Babka , linux-kernel@vger.kernel.org, linux-mm@kvack.org Subject: Re: [PATCH v1] mm: Enable suspend-only swap spaces Message-ID: <20210701200253.GB983@bug> References: <20210630100432.v1.1.I09866d90c6de14f21223a03e9e6a31f8a02ecbaf@changeid> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20210630100432.v1.1.I09866d90c6de14f21223a03e9e6a31f8a02ecbaf@changeid> User-Agent: Mutt/1.5.23 (2014-03-12) X-Rspamd-Server: rspam01 X-Rspamd-Queue-Id: 35CA230000B1 Authentication-Results: imf03.hostedemail.com; dkim=none; dmarc=none; spf=none (imf03.hostedemail.com: domain of pavel@ucw.cz has no SPF policy when checking 46.255.230.98) smtp.mailfrom=pavel@ucw.cz X-Stat-Signature: yzkqnzzzkeyat8wtid4aq7gxty1jn3wx X-HE-Tag: 1625169777-1790 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: Hi! > Currently it's not possible to enable hibernation without also enabling > generic swap for a given swap area. These two use cases are not the > same. For example there may be users who want to enable hibernation, > but whose drives don't have the write endurance for generic swap > activities. > > Add a new SWAP_FLAG_NOSWAP that adds a swap region but refuses to allow > generic swapping to it. This region can still be wired up for use in > suspend-to-disk activities, but will never have regular pages swapped to > it. > > Signed-off-by: Evan Green Makes sense to me. Reviewed-by: Pavel Machek > #define SWAP_FLAG_DISCARD_ONCE 0x20000 /* discard swap area at swapon-time */ > #define SWAP_FLAG_DISCARD_PAGES 0x40000 /* discard page-clusters after use */ > +#define SWAP_FLAG_NOSWAP 0x80000 /* use only for suspend, not swap */ I'd say "only for hibernation". And actually maybe code would be more clear if logic was reverted. Aha, and you may want to check... does the hibernation still work for you without the swap? Because we need half memory free to create swap image and swap is really quite useful for that. Best regards, Pavel -- (english) http://www.livejournal.com/~pavelmachek (cesky, pictures) http://atrey.karlin.mff.cuni.cz/~pavel/picture/horses/blog.html