Re: [PATCH] mm/filemap: let sequential faults restart mmap readahead

From: Jan Kara

Date: Tue Nov 10 2026 - 05:50:10 EST


On Mon 09-11-26 20:23:29, Alireza Haddadi wrote:
> As Sashiko noticed, with a minimum folio order (large block size
> filesystems), the 2-page request ends up as a single folio with the
> mark on the faulting folio itself. That folio gets mapped in full on
> the retry, so the mark is never hit and the readahead does not
> restart there.
>
> I checked it myself, and it's right. In v2 I'd read two minimum-size
> folios instead and mark the second one:
>
> unsigned int nr = mapping_min_folio_nrpages(mapping);
> ra->size = 2 * nr;
> ra->async_size = nr;
> ra->order = mapping_min_folio_order(mapping);
>
> With a minimum order of 0, this is the same as now. The cost stays the
> same in proportion: a miss that follows a cached page reads two
> minimum-size folios instead of one. I'll also test it on XFS with 16k
> blocks before sending v2. Would you be OK with me keeping your
> Reviewed-by for that, or would you rather look at v2 first?

Yes, I agree with this solution so feel free to keep my Reviewed-by.

Honza
--
Jan Kara <jack@xxxxxxxx>
SUSE Labs, CR