Re: [PATCH v3] mm: page_alloc: make defrag_mode retries follow the promoted order
From: Andrew Morton
Date: Sat Oct 10 2026 - 18:50:52 EST
On Fri, 9 Oct 2026 13:55:02 +0100 "Kiryl Shutsemau (Meta)" <kas@xxxxxxxxxx> wrote:
> Since commit 7e8756d7ad22 ("mm: page_alloc: fix non-movable reclaim
> storm in defrag_mode"), direct reclaim and compaction for non-movable
> requests under defrag_mode run at pageblock_order, to produce the whole
> blocks that ALLOC_NOFRAGMENT needs. The retry decisions that follow
> still use the request order. An order-0 request can therefore retry
> indefinitely without ever reaching the ALLOC_NOFRAGMENT fallback:
>
> ...
>
> When a promoted request takes the fallback, reset the retry counters,
> so that the fallback attempt gets a full retry budget before the OOM
> killer is considered. A request whose reclaim was not promoted spent
> its budget on the request itself and keeps its counters, as Usama Arif
> pointed out.
Thanks, I updated mm-unstable to this version.
> v3:
> - reset the retry counters at the fallback only for requests whose
> reclaim was promoted; a movable request already spent its budget on
> itself (Usama Arif)
hannes's concerns/questions at
https://lore.kernel.org/20261006081050.GA234057@xxxxxxxxxxx weren't
fully addressed? I'll add a note and await followup.
Here's how v3 altered mm.git:
mm/page_alloc.c | 13 ++++++++-----
1 file changed, 8 insertions(+), 5 deletions(-)
--- a/mm/page_alloc.c~mm-page_alloc-make-defrag_mode-retries-follow-the-promoted-order-v3
+++ a/mm/page_alloc.c
@@ -5030,14 +5030,17 @@ retry:
goto retry;
/*
- * Reclaim/compaction failed to prevent the fallback. The retry
- * budget was spent on making blocks, not on the request itself;
- * give the fallback a fresh one before considering OOM.
+ * Reclaim/compaction failed to prevent the fallback. A promoted
+ * request spent its retry budget on making blocks, not on the
+ * request itself; give its fallback a fresh one before
+ * considering OOM.
*/
if (defrag_mode && (alloc_flags & ALLOC_NOFRAGMENT)) {
alloc_flags &= ~ALLOC_NOFRAGMENT;
- no_progress_loops = 0;
- compaction_retries = 0;
+ if (reclaim_order != order) {
+ no_progress_loops = 0;
+ compaction_retries = 0;
+ }
goto retry;
}
_