[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <CAGsJ_4wir6nmX2xMGn2jPebCWg+wuTv05qxCBC=MgiAPN5nD1g@mail.gmail.com>
Date: Tue, 2 Jul 2024 19:00:36 +1200
From: Barry Song <21cnbao@...il.com>
To: Andrew Morton <akpm@...ux-foundation.org>
Cc: linux-mm@...ck.org, linux-kernel@...r.kernel.org,
Barry Song <v-songbaohua@...o.com>, Yosry Ahmed <yosryahmed@...gle.com>,
Nhat Pham <nphamcs@...il.com>, Chengming Zhou <chengming.zhou@...ux.dev>,
Chris Li <chrisl@...nel.org>, David Hildenbrand <david@...hat.com>,
Johannes Weiner <hannes@...xchg.org>, Matthew Wilcox <willy@...radead.org>
Subject: Re: [PATCH] mm: zswap: fix zswap_never_enabled() for CONFIG_ZSWAP==N
On Tue, Jul 2, 2024 at 6:52 PM Andrew Morton <akpm@...ux-foundation.org> wrote:
>
> On Sun, 30 Jun 2024 11:22:31 +1200 Barry Song <21cnbao@...il.com> wrote:
>
> > From: Barry Song <v-songbaohua@...o.com>
> >
> > If CONFIG_ZSWAP is set to N, it means zswap cannot be enabled.
> > zswap_never_enabled() should return true.
> >
> > ...
> >
> > --- a/include/linux/zswap.h
> > +++ b/include/linux/zswap.h
> > @@ -68,7 +68,7 @@ static inline bool zswap_is_enabled(void)
> >
> > static inline bool zswap_never_enabled(void)
> > {
> > - return false;
> > + return true;
> > }
>
> Well, that code was as wrong as it's possible to get.
>
> But what effect does this have? Seems "not much"? Perhaps we'll
> attempt a zswap_load() which later fails for other reasons?
Yes, but the API was created to inform the mm core that zswap has never been
enabled, allowing the mm core to perform mTHP swap-in. This is a transitional
solution until zswap supports mTHP. If zswap has been enabled, performing
mTHP swap-in will result in corrupted data. You may find the answer in the
mTHP swap-in series:
https://lore.kernel.org/linux-mm/CAJD7tkZ4FQr6HZpduOdvmqgg_-whuZYE-Bz5O2t6yzw6Yg+v1A@mail.gmail.com/
Thanks
Barry
Powered by blists - more mailing lists