Skip to contentSkip to conversation

mm-migrate-fix-an-incorrect-call-of-prep_transhuge_page.patch removed from -mm tree

merged [email protected] 1 participant 1 message Nov 30, 2017 Stable branch

lore
Share & tools
lore

[email protected]

author tree notice Applied
#0 lore raw

The patch titled
Subject: mm: migrate: fix an incorrect call of prep_transhuge_page()
has been removed from the -mm tree. Its filename was
mm-migrate-fix-an-incorrect-call-of-prep_transhuge_page.patch

This patch was dropped because it was merged into mainline or a subsystem tree

------------------------------------------------------
From: Zi Yan <[email protected]>
Subject: mm: migrate: fix an incorrect call of prep_transhuge_page()

In https://lkml.org/lkml/2017/11/20/411, Andrea reported that during memory hotplug/hot remove prep_transhuge_page() is called incorrectly on non-THP pages for migration, when THP is on but THP migration is not enabled. This leads to a bad state of target pages for migration.

By inspecting the code, if called on a non-THP, prep_transhuge_page() will

1) change the value of the mapping of (page + 2), since it is used for THP deferred list;

2) change the lru value of (page + 1), since it is used for THP's dtor.

Both can lead to data corruption of these two pages.

Andrea said:

: Pragmatically and from the point of view of the memory_hotplug subsys, the : effect is a kernel crash when pages are being migrated during a memory hot : remove offline and migration target pages are found in a bad state.

This patch fixes it by only calling prep_transhuge_page() when we are certain that the target page is THP.

Fixes 8135d8926c08 ("mm: memory_hotplug: memory hotremove supports thp migration")
Cc Naoya Horiguchi <[email protected]>
Cc Michal Hocko <[email protected]>
Cc "Jérôme Glisse" <[email protected]>
Cc <[email protected]> [4.14]

---

 include/linux/migrate.h |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
include/linux/migrate.h renamed from include/linux/migrate.h~mm-migrate-fix-an-incorrect-call-of-prep_transhuge_page +1 -1
diff -puN include/linux/migrate.h~mm-migrate-fix-an-incorrect-call-of-prep_transhuge_page include/linux/migrate.h
@@ -54,7 +54,7 @@ static inline struct page *new_page_node
 	new_page = __alloc_pages_nodemask(gfp_mask, order,
 				preferred_nid, nodemask);
 
-	if (new_page && PageTransHuge(page))
+	if (new_page && PageTransHuge(new_page))
 		prep_transhuge_page(new_page);
 
 	return new_page;

_

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