linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] mm: migrate: fix an incorrect call of prep_transhuge_page()
@ 2017-11-21  2:18 Zi Yan
  2017-11-21 22:12 ` Andrew Morton
  2017-11-22  8:54 ` Michal Hocko
  0 siblings, 2 replies; 16+ messages in thread
From: Zi Yan @ 2017-11-21  2:18 UTC (permalink / raw)
  To: Andrew Morton, linux-mm, linux-kernel
  Cc: Zi Yan, Andrea Reale, Naoya Horiguchi, Jérôme Glisse,
	stable

From: Zi Yan <zi.yan@cs.rutgers.edu>

In [1], 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.

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

[1] https://lkml.org/lkml/2017/11/20/411

Cc: stable@vger.kernel.org # v4.14
Fixes: 8135d8926c08 ("mm: memory_hotplug: memory hotremove supports thp migration")
Reported-by: Andrea Reale <ar@linux.vnet.ibm.com>
Signed-off-by: Zi Yan <zi.yan@cs.rutgers.edu>
Cc: Naoya Horiguchi <n-horiguchi@ah.jp.nec.com>
Cc: "JA(C)rA'me Glisse" <jglisse@redhat.com>
---
 include/linux/migrate.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/include/linux/migrate.h b/include/linux/migrate.h
index 895ec0c4942e..a2246cf670ba 100644
--- a/include/linux/migrate.h
+++ b/include/linux/migrate.h
@@ -54,7 +54,7 @@ static inline struct page *new_page_nodemask(struct page *page,
 	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;
-- 
2.14.2

--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to majordomo@kvack.org.  For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"dont@kvack.org"> email@kvack.org </a>

^ permalink raw reply related	[flat|nested] 16+ messages in thread

end of thread, other threads:[~2017-11-22 15:39 UTC | newest]

Thread overview: 16+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2017-11-21  2:18 [PATCH] mm: migrate: fix an incorrect call of prep_transhuge_page() Zi Yan
2017-11-21 22:12 ` Andrew Morton
2017-11-21 22:35   ` Zi Yan
2017-11-22  9:43     ` Andrea Reale
2017-11-22  8:54 ` Michal Hocko
2017-11-22  9:18   ` Zi Yan
2017-11-22  9:35     ` Michal Hocko
2017-11-22 10:14       ` Michal Hocko
2017-11-22 12:13         ` Zi Yan
2017-11-22 12:29           ` Zi Yan
2017-11-22 13:01             ` Michal Hocko
2017-11-22 13:40   ` Michal Hocko
2017-11-22 14:43     ` Zi Yan
2017-11-22 14:53       ` Michal Hocko
2017-11-22 15:09         ` Zi Yan
2017-11-22 15:39           ` Michal Hocko

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).