linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
From: Barry Song <21cnbao@gmail.com>
To: Andrew Morton <akpm@linux-foundation.org>
Cc: linux-mm@kvack.org, linux-kernel@vger.kernel.org,
	 Barry Song <v-songbaohua@oppo.com>,
	Yosry Ahmed <yosryahmed@google.com>,
	 Nhat Pham <nphamcs@gmail.com>,
	Chengming Zhou <chengming.zhou@linux.dev>,
	 Chris Li <chrisl@kernel.org>,
	David Hildenbrand <david@redhat.com>,
	 Johannes Weiner <hannes@cmpxchg.org>,
	Matthew Wilcox <willy@infradead.org>
Subject: Re: [PATCH] mm: zswap: fix zswap_never_enabled() for CONFIG_ZSWAP==N
Date: Tue, 2 Jul 2024 19:00:36 +1200	[thread overview]
Message-ID: <CAGsJ_4wir6nmX2xMGn2jPebCWg+wuTv05qxCBC=MgiAPN5nD1g@mail.gmail.com> (raw)
In-Reply-To: <20240701235210.5c187c85aa225292d034cafc@linux-foundation.org>

On Tue, Jul 2, 2024 at 6:52 PM Andrew Morton <akpm@linux-foundation.org> wrote:
>
> On Sun, 30 Jun 2024 11:22:31 +1200 Barry Song <21cnbao@gmail.com> wrote:
>
> > From: Barry Song <v-songbaohua@oppo.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


  reply	other threads:[~2024-07-02  7:00 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-06-29 23:22 Barry Song
2024-07-01  2:54 ` Chengming Zhou
2024-07-01 13:32 ` Yosry Ahmed
2024-07-01 17:58 ` Chris Li
2024-07-02  6:52 ` Andrew Morton
2024-07-02  7:00   ` Barry Song [this message]
2024-07-02 11:58   ` Yosry Ahmed
2024-07-03  2:02     ` Andrew Morton
2024-07-02  6:58 ` David Hildenbrand
2024-07-03 23:22 ` Nhat Pham

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to='CAGsJ_4wir6nmX2xMGn2jPebCWg+wuTv05qxCBC=MgiAPN5nD1g@mail.gmail.com' \
    --to=21cnbao@gmail.com \
    --cc=akpm@linux-foundation.org \
    --cc=chengming.zhou@linux.dev \
    --cc=chrisl@kernel.org \
    --cc=david@redhat.com \
    --cc=hannes@cmpxchg.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mm@kvack.org \
    --cc=nphamcs@gmail.com \
    --cc=v-songbaohua@oppo.com \
    --cc=willy@infradead.org \
    --cc=yosryahmed@google.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox