From: Andrew Morton <akpm@linux-foundation.org>
To: Biplab Raut <Biplab.Raut@amd.com>
Cc: <linux-kernel@vger.kernel.org>, <linux-mm@kvack.org>,
<hsiangkao@linux.alibaba.com>, <terrelln@fb.com>,
<yann.collet.73@gmail.com>, <guoxuenan@huawei.com>
Subject: Re: [PATCH] lib/lz4: add software-pipelined prefetch to decode fast loop
Date: Mon, 12 Oct 2026 20:32:57 -0700 [thread overview]
Message-ID: <20261012203257.614d88c12146544aa6487b4d@linux-foundation.org> (raw)
In-Reply-To: <20261013032010.2453893-1-Biplab.Raut@amd.com>
On Tue, 13 Oct 2026 03:20:10 +0000 Biplab Raut <Biplab.Raut@amd.com> wrote:
> From: "S. Biplab Raut" <Biplab.Raut@amd.com>
>
> LZ4 decompression of cold 4 KiB pages (the zswap/zram hot path) stalls
> on cache misses because the input stream (compressed) and output buffer
> (uncompressed page) are not resident in L1/L2. Insert read-ahead and
> write-intent prefetch hints at the top of the decode loop in
> LZ4_decompress_generic() to overlap memory latency with decode work.
>
> The prefetch distances (96 B read, 128 B write) are tuned for the
> page-at-a-time workload where both buffers fit in L1d. Prefetch is
> architecturally a no-op hint on all Linux-supported architectures;
> it never faults, never changes correctness, and compiles to nothing
> on targets without hardware prefetch.
>
> Measured on AMD EPYC 9755 (Turin, 2S×128C), Ubuntu 24.04, kernel
> 6.8.0-90-generic, real zswap path (cgroup-constrained MADV_PAGEOUT +
> full scan-back), Silesia corpus, 15 paired rounds:
>
> Kernel LZ4 median scan: 1.0994 s
> Patched median scan: 1.0472 s
> Median paired speedup: 5.09% (range 4.19%–6.99%)
> Patched was faster in all 15 rounds.
Well that's nice. I can't actually recall a case where prefetch made a
measurable difference, although I'm sure there are such cases.
We used to use prefetches often (10+ years ago) but it seems to fallen
out of favor. This code is a prime candidate. mm/ barely uses
prefetch. Maybe it should,
prev parent reply other threads:[~2026-10-13 3:32 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-10-13 3:20 Biplab Raut
2026-10-13 3:32 ` Andrew Morton [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=20261012203257.614d88c12146544aa6487b4d@linux-foundation.org \
--to=akpm@linux-foundation.org \
--cc=Biplab.Raut@amd.com \
--cc=guoxuenan@huawei.com \
--cc=hsiangkao@linux.alibaba.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mm@kvack.org \
--cc=terrelln@fb.com \
--cc=yann.collet.73@gmail.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
all inboxes | Powered by JetHome®