Re: [PATCH 1/1] iomap: avoid compaction for costly folio order allocation

Christoph Hellwig
2026-04-07T05:40:44Z

On Mon, Apr 06, 2026 at 08:43:57AM +1000, Dave Chinner wrote:
> > + if (FGF_GET_ORDER(fgp) > PAGE_ALLOC_COSTLY_ORDER)
> > + gfp &= ~__GFP_DIRECT_RECLAIM;
>
> Adding these "gfp &= ~__GFP_DIRECT_RECLAIM" hacks everywhere
> we need to do high order folio allocation is getting out of hand.

That's what I thought.

> Compaction improves long term system performance, so we don't really
> just want to turn it off whenever we have demand for high order
> folios.

Yes. Also if we want to make block size > PAGE_SIZE a real option,
just giving up on allocating large folios is not an option.

> Instead, memory reclaim should kick background compaction and let it
> do the work. If the allocation path really, really needs high order
> allocation to succeed, then it can direct the allocation to retry
> until it succeeds and the allocator itself can wait for background
> compaction to make progress.
>
> For code that has fallbacks to smaller allocations, then there is no
> need to wait for compaction - we can attempt fast smaller allocations
> and continue that way until an allocation succeeds....

Yes.