All of lore.kernel.org
 help / color / mirror / Atom feed
From: Wenwu Hou <hwenwur@gmail.com>
To: Yosry Ahmed <yosry@kernel.org>
Cc: hannes@cmpxchg.org, nphamcs@gmail.com, chengming.zhou@linux.dev,
	akpm@linux-foundation.org, linux-mm@kvack.org,
	linux-kernel@vger.kernel.org, stable@vger.kernel.org
Subject: Re: [PATCH] mm: zswap: set zswap_ever_enabled when enabling zswap at runtime
Date: Wed, 21 Oct 2026 10:01:35 +0800	[thread overview]
Message-ID: <atgc_4y2dA4egqXs@gmail.com> (raw)
In-Reply-To: <CAO9r8zNgnt=9UXN_FJ3zByVtC18MNe94-tXssAS-eAQfutNXRQ@mail.gmail.com>

On Tue, Oct 20, 2026 at 08:57:15AM -0700, Yosry Ahmed wrote:
> On Tue, Oct 20, 2026 at 5:30 AM Wenwu Hou <hwenwur@gmail.com> wrote:
> >
> > zswap can end up enabled without zswap_ever_enabled being set, which
> > leads to data corruption. With CONFIG_ZSWAP_DEFAULT_ON=n:
> >
> > 1. zswap_setup() fails to create the initial pool. Setup still counts
> >    as successful, but zswap_has_pool stays false.
> > 2. The user writes a compressor name to
> >    /sys/module/zswap/parameters/compressor.
> >    zswap_compressor_param_set() creates a pool and sets
> >    zswap_has_pool = true, but never enables the zswap_ever_enabled
> >    static key.
> > 3. The user runs "echo Y > /sys/module/zswap/parameters/enabled".
> > 4. zswap_store() now stores pages in zswap, and swap_writeout() skips
> >    writing them to the swap device.
> > 5. On swap-in, zswap_load() first checks zswap_never_enabled(). It
> >    returns true, so zswap_load() reports that the page is not in zswap.
> >    The page is then read from the swap device, which holds stale data.
> >
> > Fix this by enabling zswap_ever_enabled in zswap_enabled_param_set()
> > before zswap_enabled becomes true.
> 
> Wasn't this fixed by
> https://lore.kernel.org/linux-mm/20260906133601.3563324-1-xialonglong2025@163.com/?

Yes, please drop this one, sorry for the noise.



  reply	other threads:[~2026-10-21  2:02 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-10-20 12:29 [PATCH] mm: zswap: set zswap_ever_enabled when enabling zswap at runtime Wenwu Hou
2026-10-20 15:57 ` Yosry Ahmed
2026-10-21  2:01   ` Wenwu Hou [this message]
2026-10-21 12:31 ` sashiko-bot

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=atgc_4y2dA4egqXs@gmail.com \
    --to=hwenwur@gmail.com \
    --cc=akpm@linux-foundation.org \
    --cc=chengming.zhou@linux.dev \
    --cc=hannes@cmpxchg.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mm@kvack.org \
    --cc=nphamcs@gmail.com \
    --cc=stable@vger.kernel.org \
    --cc=yosry@kernel.org \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.