Re: [PATCH] mm/readahead: keep at least half of the async window when aligning it

From: Andrew Morton

Date: Mon Nov 02 2026 - 14:19:28 EST


On Fri, 30 Oct 2026 12:52:57 +0900 Daejun Park via B4 Relay <devnull+daejun7.park.samsung.com@xxxxxxxxxx> wrote:

> From: Daejun Park <daejun7.park@xxxxxxxxxxx>
>
> page_cache_async_ra() trims the end of each new window to a multiple of
> 1 << ra->order pages. A window that starts just below such a boundary
> keeps only a few pages. With read_ahead_kb=128 and max_sectors_kb=512,
> 1 MiB reads after a 4 KiB read at offset 0 hit this on about one window
> in three. They issue three times as many device reads.
>
> Halve the alignment until the trim keeps at least half of the window.
>

Thanks, but...

> ---
> Tested on mm-new in a QEMU guest with XFS on an emulated NVMe,
> read_ahead_kb 128 and a cold cache.
>
> - max_sectors_kb 512, median of 5 runs: reading a 512 MiB file this
> way takes 0.247 s before and 0.180 s after. The device sees 3329 and
> 1032 reads.
>
> - Other reads with max_sectors_kb 512: without the 4 KiB read, and with
> 64 KiB reads, the times do not change. Random 4 KiB and 64 KiB reads,
> two interleaved streams on one file, and 2 MiB reads at random
> offsets also take the same time. They read the same amount from the
> device, within 0.3%.
>
> With the device's transfer limit at 2 MiB:
>
> - max_sectors_kb 256: 512 KiB reads after the 4 KiB read take 0.626 s
> before and 0.322 s after. The device sees 6147 and 2056 reads.
>
> - max_sectors_kb 1024 or 2048: 1 MiB reads are not trimmed.
>
> - max_sectors_kb 2048, 3 MiB reads: the device sees 343 instead of 271
> reads. The time is 0.120 s instead of 0.118 s, the median of 40 runs.
> The interquartile range is about 0.10 to 0.13 s for both. The window
> stays at 3/4 of the maximum, off the 2 MiB boundary. mm-new reaches
> that boundary by trimming deeply.

The whole objective of the patch is "speed things up". So a description
of how much the patch sped things up is essential changelog material!

IOW, please summarize it heavily and include the performance testing
results in the actual changelog. Low-level testing details can be
retained below the ---.