[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <CAE=gft6UUesGAcT3cweFuQBOh3xFzN2gCDNGWZRqizNmPT7Rdg@mail.gmail.com>
Date: Thu, 1 Jul 2021 16:04:57 -0700
From: Evan Green <evgreen@...omium.org>
To: Pavel Machek <pavel@....cz>
Cc: Andrew Morton <akpm@...ux-foundation.org>,
Alex Shi <alexs@...nel.org>,
Alistair Popple <apopple@...dia.com>,
David Hildenbrand <david@...hat.com>,
Jens Axboe <axboe@...nel.dk>,
Johannes Weiner <hannes@...xchg.org>,
Joonsoo Kim <iamjoonsoo.kim@....com>,
"Matthew Wilcox (Oracle)" <willy@...radead.org>,
Miaohe Lin <linmiaohe@...wei.com>,
Minchan Kim <minchan@...nel.org>,
Stephen Rothwell <sfr@...b.auug.org.au>,
Vlastimil Babka <vbabka@...e.cz>,
LKML <linux-kernel@...r.kernel.org>, linux-mm@...ck.org
Subject: Re: [PATCH v1] mm: Enable suspend-only swap spaces
On Thu, Jul 1, 2021 at 1:02 PM Pavel Machek <pavel@....cz> 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 <evgreen@...omium.org>
>
> Makes sense to me.
>
> Reviewed-by: Pavel Machek <pavel@....cz>
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
Powered by blists - more mailing lists