linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
From: Barry Song <21cnbao@gmail.com>
To: Yosry Ahmed <yosryahmed@google.com>
Cc: David Hildenbrand <david@redhat.com>,
	Andrew Morton <akpm@linux-foundation.org>,
	 Johannes Weiner <hannes@cmpxchg.org>,
	Nhat Pham <nphamcs@gmail.com>,
	 Chengming Zhou <chengming.zhou@linux.dev>,
	Baolin Wang <baolin.wang@linux.alibaba.com>,
	 Chris Li <chrisl@kernel.org>,
	Ryan Roberts <ryan.roberts@arm.com>,
	 Matthew Wilcox <willy@infradead.org>,
	linux-mm@kvack.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH] mm: zswap: add VM_BUG_ON() if large folio swapin is attempted
Date: Sat, 8 Jun 2024 06:28:21 +0800	[thread overview]
Message-ID: <CAGsJ_4zU0fVj8M-qKnQAKoXdrQrBuQchs_yZ32=e2uY80kvxxA@mail.gmail.com> (raw)
In-Reply-To: <CAJD7tkZkChE_bGJCnf3u0493PZOe1=+Y8S_nq2=j1uP-BtZ9Mg@mail.gmail.com>

On Sat, Jun 8, 2024 at 7:17 AM Yosry Ahmed <yosryahmed@google.com> wrote:
>
> [..]
> > > One problem is that even if zswap was never enabled, the warning will
> > > be emitted just if CONFIG_ZSWAP is on. Perhaps we need a variable or
> > > static key if zswap was "ever" enabled.
> > >
> > > Barry, I suspect your is_zswap_enabled() check is deficient for
> > > similar reasons, zswap could have been enabled before then became
> > > disabled.
> >
> > I don't understand this. if zswap was enabled before but is disabled when
> > I am loading data, will I get corrupted data before zswap was once enabled?
> > If not, it seems nothing important.
>
> If zswap was enabled and then disabled, some pages may still be in
> zswap. We do not load the pages from zswap when it is disabled, we
> just stop storing new pages.
>
> So if you just rely in checking whether zswap is enabled at swapin
> time to decide whether to use large folios, you may end up with a
> situation where zswap is disabled, yet parts of the large folio you
> are trying to swapin (or all of it) is in zswap.
>
> This is why I think we'll need to track whether zswap was ever enabled
> instead (or if a page was ever stored).

Thanks! It doesn't seem good. Do we have a simple way to clean zswap
when it is disabled? seems not easy? Just like we do swapoff, or disable
cache, we ensure they are clean - this is a real "disable".

Thanks
Barry


  reply	other threads:[~2024-06-07 23:28 UTC|newest]

Thread overview: 21+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-06-06 18:48 Yosry Ahmed
     [not found] ` <84d78362-e75c-40c8-b6c2-56d5d5292aa7@redhat.com>
2024-06-06 20:31   ` Yosry Ahmed
2024-06-06 20:54     ` Barry Song
2024-06-06 21:00       ` Yosry Ahmed
     [not found]     ` <7507d075-9f4d-4a9b-836c-1fbb2fbd2257@redhat.com>
2024-06-06 21:30       ` Barry Song
2024-06-06 21:37         ` Yosry Ahmed
2024-06-06 21:53           ` Barry Song
2024-06-07  7:11             ` David Hildenbrand
2024-06-07 17:43               ` Yosry Ahmed
2024-06-07 18:52                 ` David Hildenbrand
2024-06-07 18:58                   ` Yosry Ahmed
2024-06-07 19:03                     ` David Hildenbrand
2024-06-07 21:13                     ` Chris Li
2024-06-07 23:14                       ` Yosry Ahmed
2024-06-07 22:09                     ` Barry Song
2024-06-08  0:28                       ` Yosry Ahmed
2024-06-07 21:20                 ` Barry Song
2024-06-07 23:17                   ` Yosry Ahmed
2024-06-07 22:28                     ` Barry Song [this message]
2024-06-08  0:32                       ` Yosry Ahmed
2024-06-06 21:36       ` Yosry Ahmed

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_4zU0fVj8M-qKnQAKoXdrQrBuQchs_yZ32=e2uY80kvxxA@mail.gmail.com' \
    --to=21cnbao@gmail.com \
    --cc=akpm@linux-foundation.org \
    --cc=baolin.wang@linux.alibaba.com \
    --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=ryan.roberts@arm.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