Skip to contentSkip to conversation

mm-record-the-migration-reason-for-struct-migration_target_control.patch removed from -mm tree

merged mm-stable Andrew Morton 1 participant 1 message Apr 26, 2024

lore
Share & tools
lore

Andrew Morton

author tree notice Applied
#0 lore raw

The quilt patch titled
Subject: mm: record the migration reason for struct migration_target_control
has been removed from the -mm tree. Its filename was
mm-record-the-migration-reason-for-struct-migration_target_control.patch

This patch was dropped because it was merged into the mm-stable branch of git://git.kernel.org/pub/scm/linux/kernel/git/akpm/mm

------------------------------------------------------
From: Baolin Wang <[email protected]>
Subject: mm: record the migration reason for struct migration_target_control
Date: Wed, 6 Mar 2024 18:13:26 +0800

Patch series "make the hugetlb migration strategy consistent", v2.

As discussed in previous thread [1], there is an inconsistency when handling hugetlb migration. When handling the migration of freed hugetlb, it prevents fallback to other NUMA nodes in alloc_and_dissolve_hugetlb_folio(). However, when dealing with in-use hugetlb, it allows fallback to other NUMA nodes in alloc_hugetlb_folio_nodemask(), which can break the per-node hugetlb pool and might result in unexpected failures when node bound workloads doesn't get what is asssumed available.

This patchset tries to make the hugetlb migration strategy more clear and consistent. Please find details in each patch.

[1]
https://lore.kernel.org/all/6f26ce22d2fcd523418a085f2c588fe0776d46e7.1706794035.git.baolin.wang@linux.alibaba.com/

This patch (of 2):

To support different hugetlb allocation strategies during hugetlb migration based on various migration reasons, record the migration reason in the migration_target_control structure as a preparation.

---

 mm/gup.c            |    1 +
 mm/internal.h       |    1 +
 mm/memory-failure.c |    1 +
 mm/memory_hotplug.c |    1 +
 mm/mempolicy.c      |    1 +
 mm/migrate.c        |    1 +
 mm/page_alloc.c     |    1 +
 mm/vmscan.c         |    3 ++-
 8 files changed, 9 insertions(+), 1 deletion(-)
mm/gup.c renamed from mm/gup.c~mm-record-the-migration-reason-for-struct-migration_target_control +1 -0
@@ -2145,6 +2145,7 @@ static int migrate_longterm_unpinnable_p
 		struct migration_target_control mtc = {
 			.nid = NUMA_NO_NODE,
 			.gfp_mask = GFP_USER | __GFP_NOWARN,
+			.reason = MR_LONGTERM_PIN,
 		};
 
 		if (migrate_pages(movable_page_list, alloc_migration_target,
mm/internal.h renamed from mm/internal.h~mm-record-the-migration-reason-for-struct-migration_target_control +1 -0
@@ -1045,6 +1045,7 @@ struct migration_target_control {
 	int nid;		/* preferred node id */
 	nodemask_t *nmask;
 	gfp_t gfp_mask;
+	enum migrate_reason reason;
 };
 
 /*
mm/memory-failure.c renamed from mm/memory-failure.c~mm-record-the-migration-reason-for-struct-migration_target_control +1 -0
@@ -2669,6 +2669,7 @@ static int soft_offline_in_use_page(stru
 	struct migration_target_control mtc = {
 		.nid = NUMA_NO_NODE,
 		.gfp_mask = GFP_USER | __GFP_MOVABLE | __GFP_RETRY_MAYFAIL,
+		.reason = MR_MEMORY_FAILURE,
 	};
 
 	if (!huge && folio_test_large(folio)) {
mm/memory_hotplug.c renamed from mm/memory_hotplug.c~mm-record-the-migration-reason-for-struct-migration_target_control +1 -0
@@ -1841,6 +1841,7 @@ static void do_migrate_range(unsigned lo
 		struct migration_target_control mtc = {
 			.nmask = &nmask,
 			.gfp_mask = GFP_USER | __GFP_MOVABLE | __GFP_RETRY_MAYFAIL,
+			.reason = MR_MEMORY_HOTPLUG,
 		};
 		int ret;
 
mm/mempolicy.c renamed from mm/mempolicy.c~mm-record-the-migration-reason-for-struct-migration_target_control +1 -0
@@ -1070,6 +1070,7 @@ static long migrate_to_node(struct mm_st
 	struct migration_target_control mtc = {
 		.nid = dest,
 		.gfp_mask = GFP_HIGHUSER_MOVABLE | __GFP_THISNODE,
+		.reason = MR_SYSCALL,
 	};
 
 	nodes_clear(nmask);
mm/migrate.c renamed from mm/migrate.c~mm-record-the-migration-reason-for-struct-migration_target_control +1 -0
@@ -2060,6 +2060,7 @@ static int do_move_pages_to_node(struct
 	struct migration_target_control mtc = {
 		.nid = node,
 		.gfp_mask = GFP_HIGHUSER_MOVABLE | __GFP_THISNODE,
+		.reason = MR_SYSCALL,
 	};
 
 	err = migrate_pages(pagelist, alloc_migration_target, NULL,
mm/page_alloc.c renamed from mm/page_alloc.c~mm-record-the-migration-reason-for-struct-migration_target_control +1 -0
@@ -6351,6 +6351,7 @@ int __alloc_contig_migrate_range(struct
 	struct migration_target_control mtc = {
 		.nid = zone_to_nid(cc->zone),
 		.gfp_mask = GFP_USER | __GFP_MOVABLE | __GFP_RETRY_MAYFAIL,
+		.reason = MR_CONTIG_RANGE,
 	};
 	struct page *page;
 	unsigned long total_mapped = 0;
mm/vmscan.c renamed from mm/vmscan.c~mm-record-the-migration-reason-for-struct-migration_target_control +2 -1
@@ -967,7 +967,8 @@ static unsigned int demote_folio_list(st
 		.gfp_mask = (GFP_HIGHUSER_MOVABLE & ~__GFP_RECLAIM) | __GFP_NOWARN |
 			__GFP_NOMEMALLOC | GFP_NOWAIT,
 		.nid = target_nid,
-		.nmask = &allowed_mask
+		.nmask = &allowed_mask,
+		.reason = MR_DEMOTION,
 	};
 
 	if (list_empty(demote_folios))

_

Patches currently in -mm which might be from [email protected] are

mm-page_alloc-allowing-mthp-compaction-to-capture-the-freed-page-directly.patch