Re: [PATCH 3/3] mm/readahead: try to allocate high order pages for FADVISE_FAV_WILLNEED

From: Matthew Wilcox

Date: Tue Dec 02 2025 - 17:56:49 EST


On Tue, Dec 02, 2025 at 01:30:13AM +0000, Jaegeuk Kim wrote:
> @@ -627,7 +628,7 @@ void page_cache_sync_ra(struct readahead_control *ractl,
> ra->size = min(contig_count + req_count, max_pages);
> ra->async_size = 1;
> readit:
> - ra->order = 0;
> + ra->order = mapping_max_folio_order(ractl->mapping);
> ractl->_index = ra->start;
> page_cache_ra_order(ractl, ra);
> }

I suspect this is in the wrong place, but I'm on holiday and not going
to go spelunking through the readahead code looking for the right place.

Also, going directly to max folio order is wrong, we should use the same
approach as the write order code, encapsulated in filemap_get_order().
See 4f6617011910