Re: [PATCH v3] mm: page_alloc: make defrag_mode retries follow the promoted order
From: Kiryl Shutsemau
Date: Thu Oct 15 2026 - 09:01:22 EST
On Wed, Oct 14, 2026 at 10:29:36PM +0200, Johannes Weiner wrote:
> On Tue, Oct 13, 2026 at 06:37:20PM +0100, Kiryl Shutsemau wrote:
> > @@ -4127,6 +4127,12 @@ __alloc_pages_may_oom(gfp_t gfp_mask, unsigned int order,
> > return page;
> > }
> >
> > +static inline bool order_nofrag_promoted(unsigned int order,
> > + const struct alloc_context *ac)
> > +{
> > + return ac->reclaim_compact_order != order;
> > +}
>
> order_defrag_promoted?
Works for me.
Andrew, could you fold the fixup below?
---
diff --git a/mm/page_alloc.c b/mm/page_alloc.c
index c593913a14f8..440e515be50b 100644
--- a/mm/page_alloc.c
+++ b/mm/page_alloc.c
@@ -4127,7 +4127,7 @@ __alloc_pages_may_oom(gfp_t gfp_mask, unsigned int order,
return page;
}
-static inline bool order_nofrag_promoted(unsigned int order,
+static inline bool order_defrag_promoted(unsigned int order,
const struct alloc_context *ac)
{
return ac->reclaim_compact_order != order;
@@ -4260,7 +4260,7 @@ should_compact_retry(gfp_t gfp_mask, struct alloc_context *ac, int order,
* Promoted requests fall back instead.
*/
if (compact_result == COMPACT_SKIPPED) {
- if (!order_nofrag_promoted(order, ac))
+ if (!order_defrag_promoted(order, ac))
ret = compaction_zonelist_suitable(ac, order,
alloc_flags, gfp_mask);
goto out;
@@ -4642,7 +4642,7 @@ should_reclaim_retry(gfp_t gfp_mask, unsigned order,
* for compaction without freeing anything.
*/
if (did_some_progress && order <= PAGE_ALLOC_COSTLY_ORDER &&
- !order_nofrag_promoted(order, ac))
+ !order_defrag_promoted(order, ac))
*no_progress_loops = 0;
else
(*no_progress_loops)++;
@@ -5024,7 +5024,7 @@ __alloc_pages_slowpath(gfp_t gfp_mask, unsigned int order,
if (defrag_mode && (alloc_flags & ALLOC_NOFRAGMENT)) {
alloc_flags &= ~ALLOC_NOFRAGMENT;
/* Retries went into making blocks, start the fallback afresh */
- if (order_nofrag_promoted(order, ac)) {
+ if (order_defrag_promoted(order, ac)) {
no_progress_loops = 0;
compaction_retries = 0;
}
--
Kiryl Shutsemau / Kirill A. Shutemov