[RFC PATCH 3/4] mm: compaction: don't skip proactive compaction for non-costly mTHP
From: Bo Zhang
Date: Tue Aug 25 2026 - 00:39:53 EST
When the minimum always-enabled mTHP order is below
PAGE_ALLOC_COSTLY_ORDER, do not skip proactive compaction even if kswapd
is running. For these non-costly mTHP orders, kswapd reclaim alone may
not produce the contiguous free blocks needed, so proactive compaction
should proceed concurrently to ensure mTHP allocation success.
Signed-off-by: Bo Zhang <zhangbo56@xxxxxxxxxx>
---
mm/compaction.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/mm/compaction.c b/mm/compaction.c
index a15ed2576562..15b92475562a 100644
--- a/mm/compaction.c
+++ b/mm/compaction.c
@@ -2323,9 +2323,10 @@ static enum compact_result __compact_finished(struct compact_control *cc)
if (cc->proactive_compaction) {
int score, wmark_low;
pg_data_t *pgdat;
+ bool costly = compact_hpage_order() > PAGE_ALLOC_COSTLY_ORDER;
pgdat = cc->zone->zone_pgdat;
- if (kswapd_is_running(pgdat))
+ if (costly && kswapd_is_running(pgdat))
return COMPACT_PARTIAL_SKIPPED;
score = fragmentation_score_zone(cc->zone, compact_hpage_order());
--
2.34.1