From: Gao Xiang <xiang@kernel.org>
To: Wenjie Qi <qwjhust@gmail.com>
Cc: xiang@kernel.org, chao@kernel.org, linux-erofs@lists.ozlabs.org,
linux-fsdevel@vger.kernel.org, shengyong1@xiaomi.com,
yangyongpeng@xiaomi.com, qiwenjie@xiaomi.com
Subject: Re: [PATCH] erofs: enable buffered RWF_DONTCACHE reads
Date: Thu, 19 Nov 2026 22:17:47 +0100 [thread overview]
Message-ID: <av9ne1tKVIBQgCI0@MacBookPro.fritz.box> (raw)
In-Reply-To: <b168501806b41e3f0be15efec4b54b371d8dd4e1.1795059802.git.qiwenjie@xiaomi.com>
On Thu, Nov 19, 2026 at 11:52:50AM +0800, Wenjie Qi wrote:
> From: Wenjie Qi <qiwenjie@xiaomi.com>
>
> EROFS uses filemap_read() for buffered reads, including the inode-sharing
> path, which preserves request flags when cloning the kiocb.
>
> Advertise FOP_DONTCACHE in both file operation tables so preadv2() callers
> can request that newly instantiated file-cache folios be dropped after
> consumption. This is useful for one-pass reads that need not retain data
> in the page cache.
>
> For compressed reads, retain trailing readmore and propagate dropbehind
> to the single-folio neighbor lookup. Readahead expansion already marks
> new folios through readahead_control. Suppress prefix readmore so it
> cannot refill pages already consumed and evicted. Ordinary readmore is
> unchanged.
>
> Tested sequential reads of 1-GiB files with 1-MiB requests on NVMe-backed
> LZ4 and Zstd EROFS images in x86-64 QEMU/KVM with two vCPUs and 2 GiB RAM.
> Each reader ran with memory.max=255852544 (244 MiB) and
> memory.swap.max=0. Normal and dontcache ran in ten paired rounds per
> layout, alternating their order and using a fresh guest for each run.
>
> Results are arithmetic means of ten runs. Memory values average the
> run-level time-weighted memory.current means. Percentage changes are
> relative to normal reads:
>
> MiB/s Mean memory, MiB
> Layout normal/dontcache change normal/dontcache change
> LZ4 2513.57/6350.61 +152.65% 169.53/17.39 -89.74%
> Zstd 2535.57/4066.49 +60.38% 179.01/18.17 -89.85%
>
> In this test, dontcache reduced average cgroup memory by about 90%,
> left no consumed file pages resident and recorded no memcg reclaim
> scans or steals. Both layouts were faster in all ten pairs. This
> offers a smaller cache footprint for one-pass reads on memory-constrained
> systems.
>
> Signed-off-by: Wenjie Qi <qiwenjie@xiaomi.com>
> Signed-off-by: Sheng Yong <shengyong1@xiaomi.com>
> Reviewed-by: Yongpeng Yang <yangyongpeng@xiaomi.com>
Yeah, that was in my own plan too but I never find a slot, thank you.
It would be useful for one-time load on large files like AI models
and these numbers are impressive:
Reviewed-by: Gao Xiang <xiang@kernel.org>
Thanks,
Gao Xiang
prev parent reply other threads:[~2026-11-19 21:17 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-11-19 3:52 [PATCH] erofs: enable buffered RWF_DONTCACHE reads Wenjie Qi
2026-11-19 21:17 ` Gao Xiang [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=av9ne1tKVIBQgCI0@MacBookPro.fritz.box \
--to=xiang@kernel.org \
--cc=chao@kernel.org \
--cc=linux-erofs@lists.ozlabs.org \
--cc=linux-fsdevel@vger.kernel.org \
--cc=qiwenjie@xiaomi.com \
--cc=qwjhust@gmail.com \
--cc=shengyong1@xiaomi.com \
--cc=yangyongpeng@xiaomi.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