Commit f1549c67 authored by Aneesh Kumar K.V's avatar Aneesh Kumar K.V Committed by Greg Kroah-Hartman

mm/hugetlb: filter out hugetlb pages if HUGEPAGE migration is not supported.

commit 464c7ffb upstream.

When scanning for movable pages, filter out Hugetlb pages if hugepage
migration is not supported.  Without this we hit infinte loop in
__offline_pages() where we do

	pfn = scan_movable_pages(start_pfn, end_pfn);
	if (pfn) { /* We have movable pages */
		ret = do_migrate_range(pfn, end_pfn);
		goto repeat;

Fix this by checking hugepage_migration_supported both in
has_unmovable_pages which is the primary backoff mechanism for page
offlining and for consistency reasons also into scan_movable_pages
because it doesn't make any sense to return a pfn to non-migrateable
huge page.

This issue was revealed by, but not caused by 72b39cfc ("mm,
memory_hotplug: do not fail offlining too early").

Fixes: 72b39cfc ("mm, memory_hotplug: do not fail offlining too early")
Signed-off-by: default avatarAneesh Kumar K.V <>
Reported-by: default avatarHaren Myneni <>
Acked-by: default avatarMichal Hocko <>
Reviewed-by: default avatarNaoya Horiguchi <>
Cc: <>
Signed-off-by: default avatarAndrew Morton <>
Signed-off-by: default avatarLinus Torvalds <>
Signed-off-by: default avatarGreg Kroah-Hartman <>
parent c0cbb9e5
......@@ -1341,7 +1341,8 @@ static unsigned long scan_movable_pages(unsigned long start, unsigned long end)
if (__PageMovable(page))
return pfn;
if (PageHuge(page)) {
if (page_huge_active(page))
if (hugepage_migration_supported(page_hstate(page)) &&
return pfn;
pfn = round_up(pfn + 1,
......@@ -7649,6 +7649,10 @@ bool has_unmovable_pages(struct zone *zone, struct page *page, int count,
* handle each tail page individually in migration.
if (PageHuge(page)) {
if (!hugepage_migration_supported(page_hstate(page)))
goto unmovable;
iter = round_up(iter + 1, 1<<compound_order(page)) - 1;
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment