Re: [PATCH v3] mm: page_alloc: make defrag_mode retries follow the promoted order

From: Andrew Morton

Date: Mon Oct 12 2026 - 22:28:47 EST


On Mon, 12 Oct 2026 13:40:36 +0200 "Vlastimil Babka (SUSE)" <vbabka@xxxxxxxxxx> wrote:

> > In a VM reproducer (32G, defrag_mode, inode churn under memory.low):
> >
> > before after
> > should_reclaim_retry() calls 63M 293k
> > peak memory pressure (PSI some avg10) 99% 12%
> >
> > File creation runs 5.7x faster.
> >
> > Fixes: 7e8756d7ad22 ("mm: page_alloc: fix non-movable reclaim storm in defrag_mode")
> > Cc: stable@xxxxxxxxxxxxxxx
> > Assisted-by: LLM
> > Signed-off-by: Kiryl Shutsemau (Meta) <kas@xxxxxxxxxx>
>
> LGTM, but I think we could simplify and get rid of all the function
> parameter additions by adding a field to alloc_context instead? We could
> call it e.g. reclaim_compact_order.
>
> The function nofrag_promote_order() probably doesn't need to exist, given it
> has just one caller, could be just open coded.
>
> What could be useful instead is wrapper for comparing order vs
> ac->reclaim_compact_order. E.g. something like bool
> order_nofrag_promoted(order, ac) ?

I'm concerned about the sheer size of this patch. It fixes significant
issues, but it's not going to be a simple or safe backport.

So for now please let's optimize for simplicity and backportability and
defer cleanups for the -rc cycle.

Of course, if the changes you suggest achieve that then go for it.

Perhaps we should defer this change into next -rc? It has cc:stable so
it'll eventually end up where we want it.