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=-11.2 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_CR_TRAILER,MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS autolearn=unavailable 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 106E2C11F6A for ; Thu, 1 Jul 2021 23:05:39 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id 92F606140E for ; Thu, 1 Jul 2021 23:05:38 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 92F606140E Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=chromium.org Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=owner-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix) id E857C8D02B8; Thu, 1 Jul 2021 19:05:37 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id E0E538D0001; Thu, 1 Jul 2021 19:05:37 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id C61308D02B8; Thu, 1 Jul 2021 19:05:37 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0112.hostedemail.com [216.40.44.112]) by kanga.kvack.org (Postfix) with ESMTP id 9C9038D0001 for ; Thu, 1 Jul 2021 19:05:37 -0400 (EDT) Received: from smtpin23.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay01.hostedemail.com (Postfix) with ESMTP id 4CD36181D7EC4 for ; Thu, 1 Jul 2021 23:05:37 +0000 (UTC) X-FDA: 78315552714.23.BEC78BD Received: from mail-io1-f43.google.com (mail-io1-f43.google.com [209.85.166.43]) by imf24.hostedemail.com (Postfix) with ESMTP id 02BDDB000099 for ; Thu, 1 Jul 2021 23:05:36 +0000 (UTC) Received: by mail-io1-f43.google.com with SMTP id a6so9609971ioe.0 for ; Thu, 01 Jul 2021 16:05:36 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=NiNIR6k4gDoDe9HuA7sGuhCI/TkwRDGteUCqF497qiU=; b=Ow/9xnEEMDhkeugBMrtf5hTfF6mqrQRonwSEJ26ic5Nt0oKlElmcPATRr2c5IAGV43 +YErFUWWRqev2mSzxL1QcA0pBctGDwLTYlyrG9oXIo4JNDO5mI25ir4JrRHSKhzLtgd2 A9HcIj+7wwILa2VC6MzGJcdXM52Fd6mZ4wxbI= 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=NiNIR6k4gDoDe9HuA7sGuhCI/TkwRDGteUCqF497qiU=; b=n9z6NHTUnHBk/nlR3AFM5T4fvOXeKtmT652G0LLGMVovZG9faKVHsb7r19SMkS6TQO Lkt5+6pXVt20GaREgQgJKUqfw6yqt45gUug8lkLNo+IBIoPPwiYafuzIcJXaeiT5ove7 /S2iudn7Xqv6T1KXADAYUv/QV2N73axswvfkgiT5C9iQmrtVyHFRjlBzJVAEmxFozuO2 SUHjDXOu7aks/jI9mTorwit5Pr+OhAIsT51pM6HHIiQGrOOEwpoKWZxCj4AmoJGRbLKR 2EohJichOoiD217A1QaWpf3WaBW+YJ7HpmZsfbe8myc8eCKqc5P+OYFTbZkA+lsAb1Ay AtoQ== X-Gm-Message-State: AOAM532QeisUEyo1Y1BmTWK02ycyaQ1/tSttdTgAO+fHAshastWytOAM 35UVqxHQhnIuZ479Vy3Kn9wSsgzrdhioL3RY X-Google-Smtp-Source: ABdhPJz4I+eMzHfuWdzOOmcTk/Qqa9T3Ks62qVpDV3KnzYSOhibB5AZ/IAzZDUb/aK2nFmTGGwIoEg== X-Received: by 2002:a02:a310:: with SMTP id q16mr1920651jai.8.1625180736243; Thu, 01 Jul 2021 16:05:36 -0700 (PDT) Received: from mail-il1-f180.google.com (mail-il1-f180.google.com. [209.85.166.180]) by smtp.gmail.com with ESMTPSA id s2sm645527ioo.45.2021.07.01.16.05.33 for (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Thu, 01 Jul 2021 16:05:34 -0700 (PDT) Received: by mail-il1-f180.google.com with SMTP id i13so8052643ilu.4 for ; Thu, 01 Jul 2021 16:05:33 -0700 (PDT) X-Received: by 2002:a92:7b07:: with SMTP id w7mr1261220ilc.308.1625180733446; Thu, 01 Jul 2021 16:05:33 -0700 (PDT) MIME-Version: 1.0 References: <20210630100432.v1.1.I09866d90c6de14f21223a03e9e6a31f8a02ecbaf@changeid> <20210701200253.GB983@bug> In-Reply-To: <20210701200253.GB983@bug> From: Evan Green Date: Thu, 1 Jul 2021 16:04:57 -0700 X-Gmail-Original-Message-ID: Message-ID: Subject: Re: [PATCH v1] mm: Enable suspend-only swap spaces To: Pavel Machek 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 , LKML , linux-mm@kvack.org Content-Type: text/plain; charset="UTF-8" Authentication-Results: imf24.hostedemail.com; dkim=pass header.d=chromium.org header.s=google header.b="Ow/9xnEE"; spf=pass (imf24.hostedemail.com: domain of evgreen@chromium.org designates 209.85.166.43 as permitted sender) smtp.mailfrom=evgreen@chromium.org; dmarc=pass (policy=none) header.from=chromium.org X-Rspamd-Server: rspam03 X-Rspamd-Queue-Id: 02BDDB000099 X-Stat-Signature: yjmo7cdjtoaxfxiyyq7w3naizjmnjb6k X-HE-Tag: 1625180736-109770 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 Thu, Jul 1, 2021 at 1:02 PM Pavel Machek wrote: > > 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 Thanks! > > > #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. Sure about the rewording. Yes, I also thought about flipping the polarity. This made more sense to me as an outlier condition, despite the slight awkwardness of a negative flag. And the usermode flag has to be written this way, so I might as well carry it through. I think I'll keep it unless anyone feels strongly. > > 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. Yes, hibernation still works. You're right that without another swap space set up, it starts to fail when half of memory is used up. This flag gives me the control to exclusively steer swap towards one device and hibernate towards another. -Evan