From: Joshua Hahn <joshua.hahnjy@gmail.com>
To: Yosry Ahmed <yosry@kernel.org>
Cc: 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
Subject: Re: [PATCH] mm/zswap: flush dcache in the compressed decompression path
Date: Fri, 10 Jul 2026 11:40:50 -0700 [thread overview]
Message-ID: <20260710184052.3614560-1-joshua.hahnjy@gmail.com> (raw)
In-Reply-To: <CAO9r8zN4ig_GGP4a=NLZ9PUW+jFmSfY1yBLrkPA9azvDCrGSvQ@mail.gmail.com>
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?
Joshua
next prev parent reply other threads:[~2026-07-10 18:40 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 [this message]
2026-07-10 18:43 ` Yosry Ahmed
2026-07-11 0:25 ` Zenghui Yu
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=20260710184052.3614560-1-joshua.hahnjy@gmail.com \
--to=joshua.hahnjy@gmail.com \
--cc=akpm@linux-foundation.org \
--cc=chengming.zhou@linux.dev \
--cc=hannes@cmpxchg.org \
--cc=husong@kylinos.cn \
--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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox