Re: [PATCH] ext4: avoid full buffer walks for large folio partial writes
From: Jia Zhu
Date: Mon Jun 08 2026 - 08:02:14 EST
On Fri, Jun 05, 2026 at 03:24:20PM +0100, Matthew Wilcox wrote:
> > The reason I am still looking at this path is that the regression is
> > visible in our LTS upgrade testing from 6.12 to 6.18. It was introduced
> > by the ext4 large-folio enablement in v6.16. For example, in our
> > libMicro release benchmark with THP always enabled, usecs/call, lower is
> > better:
> >
> > case v6.12 v6.18 regression
> > write_u1k 0.609 4.659 +665.0%
> > write_u10k 1.408 4.869 +245.8%
>
> Ouch ;-) No wonder you want to address this. Do you recover all the
> regression with this fix?
With the full v2 series applied to v6.18, the small overwrite cases look
like this. Results are usecs/call, lower is better:
case v6.12 v6.18 v6.18 + series
write_u1k 0.609 4.659 0.528
write_u10k 1.408 4.869 0.809
pwrite_u1k 0.609 4.659 0.538
pwrite_u10k 1.399 4.889 0.819
writev_u1k 2.238 5.277 1.179
writev_u10k 11.057 8.029 4.219
This matches the regression I was trying to address.
> > The iomap conversion is the long-term fix, but it does not help kernels
> > which still use the buffer-head buffered write path. I would like to keep
> > this as a small regression fix for that path, and make it minimal enough
> > to be suitable for stable/LTS backport.
>
> Is it that you're using some ext4 features that aren't supported by
> iomap yet? Could you say which ones? That might motivate someone to
> prioritise that support.
No, this benchmark is not using a specific ext4 feature that prevents
iomap. It is just the default ext4 buffered write path on a regular
file.
I agree that iomap looks like the better long-term direction for ext4
buffered writes. This small fix is mainly motivated by current/LTS
kernels that still have the buffer-head path (from v6.16 through current
mainline, until ext4 buffered writes are converted to iomap upstream),
where the large-folio enablement made this tail-walk cost visible.