[PATCH] mm/damon: prevent migration fallback to non-target nodes
From: zjh
Date: Wed Jul 08 2026 - 04:15:18 EST
DAMOS_MIGRATE_{HOT,COLD} passes a target NUMA node to migrate_pages().
But alloc_migration_target() treats mtc->nid as a preferred node unless
__GFP_THISNODE is set. Hence target allocation can fall back to another
node, and migrate_pages() can report success without placing the folio on
the requested target node.
Make DAMON migration target allocation strict by setting __GFP_THISNODE.
This is consistent with alloc_misplaced_dst_folio() and
alloc_demote_folio(), which also use __GFP_THISNODE for migrations to an
explicit destination node.
Signed-off-by: zjh <jiahuitry@xxxxxxxxxxx>
---
mm/damon/ops-common.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/mm/damon/ops-common.c b/mm/damon/ops-common.c
index 6bdd1cfd3863..d21b106b81ca 100644
--- a/mm/damon/ops-common.c
+++ b/mm/damon/ops-common.c
@@ -311,7 +311,7 @@ static unsigned int __damon_migrate_folio_list(
* instead of migrated.
*/
.gfp_mask = (GFP_HIGHUSER_MOVABLE & ~__GFP_RECLAIM) |
- __GFP_NOMEMALLOC | GFP_NOWAIT,
+ __GFP_NOMEMALLOC | GFP_NOWAIT | __GFP_THISNODE,
.nid = target_nid,
};
base-commit: 42db70db0bf4f1aa4eac4ddbe121143131b793df
--
2.53.0