[PATCH 0/2] mm/compaction: stop repeating failed async compaction on every THP fault

From: Qiliang Yuan

Date: Thu Oct 01 2026 - 12:06:37 EST


A THP fault on a MADV_HUGEPAGE VMA tries the local node first with a
single round of async direct compaction. A failed async run is never
deferred, so when the local node is fragmented by memory that can't be
migrated, such as long-term RDMA pins, every 2M fault scans the zone
again before falling back to another node.

Patch 1 splits the deferral state by migration mode. Patch 2 defers
async compaction on its own state after it fails, leaving sync
compaction as it is.

Populating a 4 GiB MADV_HUGEPAGE buffer on a node fragmented by pinned
memory, direct compactions drop from 735 to 15 and the time spent in
compaction from 122.7 ms to 3.6 ms. Fewer of the THPs are allocated on
the local node, 1126 instead of 1313; the rest come from the other
node. Details and the movable-memory case are in patch 2.

Signed-off-by: Qiliang Yuan <odys.yuan@xxxxxxxxx>
---
Qiliang Yuan (2):
mm/compaction: keep compaction deferral state per migration mode
mm/compaction: defer failed async direct compaction

include/linux/mmzone.h | 7 ++--
include/trace/events/compaction.h | 27 ++++++++------
mm/compaction.c | 77 ++++++++++++++++++++++-----------------
3 files changed, 63 insertions(+), 48 deletions(-)
---
base-commit: 551c722f40809618230001baccf219193e22fc5a
change-id: 20261001-bug-mm-thp-async-compact-defer-b83351bfb25d

Best regards,
--
Qiliang Yuan <odys.yuan@xxxxxxxxx>