From: Zenghui Yu <zenghui.yu@linux.dev>
To: Yosry Ahmed <yosry@kernel.org>
Cc: Joshua Hahn <joshua.hahnjy@gmail.com>,
Song Hu <husong@kylinos.cn>,
linux-mm@kvack.org, hannes@cmpxchg.org, nphamcs@gmail.com,
chengming.zhou@linux.dev, ljs@kernel.org,
akpm@linux-foundation.org, linux-kernel@vger.kernel.org,
herbert@gondor.apana.org.au
Subject: Re: [PATCH] mm/zswap: flush dcache in the compressed decompression path
Date: Sat, 11 Jul 2026 08:25:31 +0800 [thread overview]
Message-ID: <133c3c19-22ae-4de5-98e0-6970b707bf37@linux.dev> (raw)
In-Reply-To: <CAO9r8zOuRFcYnLGUcRYyg9_nAk1TvCxUvV_0101msKL0Mx0P6A@mail.gmail.com>
[+Cc Herbert, in case you missed that]
On 7/11/26 2:43 AM, Yosry Ahmed wrote:
> On Fri, Jul 10, 2026 at 11:40 AM Joshua Hahn <joshua.hahnjy@gmail.com> wrote:
> >
> > On Fri, 10 Jul 2026 11:22:43 -0700 Yosry Ahmed <yosry@kernel.org> wrote:
> >
> > > On Fri, Jul 10, 2026 at 1:28 AM Song Hu <husong@kylinos.cn> wrote:
> > > >
> > > > Both branches of zswap_decompress() write the destination folio through a
> > > > kernel mapping: the incompressible branch via kmap_local_folio() and the
> > > > compressed branch via the crypto scatterwalk. Yet only the incompressible
> > > > branch calls flush_dcache_folio(); the compressed branch was missed. On
> > > > aliasing D-cache architectures this can leave stale cache lines visible to
> > > > userland after a zswap load.
> > >
> > > Adding Herbert here.
> > >
> > > Doesn't the Crypto API take care of this for the decompression path?
> > > Maybe in scomp_acomp_comp_decomp()?
> >
> > This is what I think too. Actually if you use something like
> > zstd_decompress() as well, it ends up calling:
> > acomp_walk_done_dst() --> scatterwalk_done_dst()
> > --> __scatterwalk_flush_dcache_pages()
> > --> flush_dcache_page()
> > over all the pages in the loop.
> >
> > Maybe I'm missing a path here that would require us to manually flush
> > from zswap? But even still, I think that should be handled by the
> > path that is repsonsible for doing the actual decompression, not
> > zswap.
> >
> > What do you think?
>
> Yeah I am hoping Herbert will help us out here.
>
prev parent reply other threads:[~2026-07-11 0:25 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-07-10 8:28 [PATCH] mm/zswap: flush dcache in the compressed decompression path Song Hu
2026-07-10 17:57 ` Nhat Pham
2026-07-10 18:22 ` Yosry Ahmed
2026-07-10 18:40 ` Joshua Hahn
2026-07-10 18:43 ` Yosry Ahmed
2026-07-11 0:25 ` Zenghui Yu [this message]
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=133c3c19-22ae-4de5-98e0-6970b707bf37@linux.dev \
--to=zenghui.yu@linux.dev \
--cc=akpm@linux-foundation.org \
--cc=chengming.zhou@linux.dev \
--cc=hannes@cmpxchg.org \
--cc=herbert@gondor.apana.org.au \
--cc=husong@kylinos.cn \
--cc=joshua.hahnjy@gmail.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mm@kvack.org \
--cc=ljs@kernel.org \
--cc=nphamcs@gmail.com \
--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.