Re: [PATCH v2] mm/filemap: avoid costly reclaim for high-order folio allocations

Matthew Wilcox
2026-04-20T19:12:20Z

On Mon, Apr 20, 2026 at 04:14:03PM +0000, Salvatore Dipietro wrote:
> v2:
> - strip __GFP_DIRECT_RECLAIM to avoid costly reclaim for high-order
> folio allocations
> - Moved fix from iomap to mm/filemap layer

I don't think filemap is the right place for this. And neither does
Dave Chinner, nor Christoph Hellwig:

https://lore.kernel.org/all/adSY3GnLHyQatigQ@infradead.org/

I asked you for performance results with different patches, and you
didn't reply. Now you're asking for this patch to be merged instead.
THIS IS NOT HOW IT WORKS. You answer the damned questions being asked
of you by your fellow developers.

> err = -ENOMEM;
> - if (order > min_order)
> - alloc_gfp |= __GFP_NORETRY | __GFP_NOWARN;
> + if (order > min_order) {
> + alloc_gfp |= __GFP_NOWARN;
> + if (order > PAGE_ALLOC_COSTLY_ORDER)
> + alloc_gfp &= ~__GFP_DIRECT_RECLAIM;
> + else
> + alloc_gfp |= __GFP_NORETRY;
> + }
> folio = filemap_alloc_folio(alloc_gfp, order, policy);
> if (!folio)
> continue;
>
> base-commit: c7275b05bc428c7373d97aa2da02d3a7fa6b9f66
> --
> 2.47.3
>
>
>
>
> AMAZON DEVELOPMENT CENTER ITALY SRL, viale Monte Grappa 3/5, 20124 Milano, Italia, Registro delle Imprese di Milano Monza Brianza Lodi REA n. 2504859, Capitale Sociale: 10.000 EUR i.v., Cod. Fisc. e P.IVA 10100050961, Societa con Socio Unico
>
>
>