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

From: Kiryl Shutsemau

Date: Tue Oct 27 2026 - 07:06:18 EST


On Tue, Oct 27, 2026 at 12:42:12PM +0530, Dev Jain wrote:
>
>
> On 23/10/26 8:16 pm, Kiryl Shutsemau wrote:
> > On Fri, Oct 23, 2026 at 01:12:02PM +0100, Kiryl Shutsemau wrote:
> >> The diff below replaces the previous one. It needs cleanup and splitting
> >> before it goes upstream.
> >
> > Proper patchset:
> >
> > https://git.kernel.org/pub/scm/linux/kernel/git/kas/linux.git page_alloc/nofrag-watermark-v1
> >
>
> Thanks! I applied the 3 commits on top and the results improved a lot. Your patches
> make sense to me.

Thanks for testing.

Can I use your Tested-by?

> But still, I see more compact_stalls and a worse compaction success:fail ratio. The
> limitation must be by definition I believe: we still won't be able to use 64K blocks
> from non-movable pageblocks.

Right, that is by design.

defrag_mode keeps the free space in unmovable and reclaimable blocks for
those allocations, so they don't spill into movable blocks. Your 64K
faults never take it.

The price is that defrag_mode needs more free memory for the same
workload. In return, the system does not fragment over time: huge page
availability stays steady instead of decaying under load.

The benchmark runs right at the edge: it fills 99% of MemAvailable and
then faults another 20% in 64K. defrag_mode=0 takes the 64K chunks it
finds in non-movable blocks without compacting. defrag_mode=1 has to
build them inside movable blocks, and with memory full there is little
free space there. So more compaction, and more of it fails.

The 64K fault count ends up close anyway: 20.1k vs 20.7k in my runs.

--
Kiryl Shutsemau / Kirill A. Shutemov