diff --git a/mm/page_alloc.c b/mm/page_alloc.c
index e2afdb2dc2c548ad618f0ba634fd0e37b2e320b1..e95b5b7c9c3d637efe29d07d86c75975acbfc500 100644
--- a/mm/page_alloc.c
+++ b/mm/page_alloc.c
@@ -7814,11 +7814,14 @@ bool has_unmovable_pages(struct zone *zone, struct page *page, int count,
 		 * handle each tail page individually in migration.
 		 */
 		if (PageHuge(page)) {
+			struct page *head = compound_head(page);
+			unsigned int skip_pages;
 
-			if (!hugepage_migration_supported(page_hstate(page)))
+			if (!hugepage_migration_supported(page_hstate(head)))
 				goto unmovable;
 
-			iter = round_up(iter + 1, 1<<compound_order(page)) - 1;
+			skip_pages = (1 << compound_order(head)) - (page - head);
+			iter += skip_pages - 1;
 			continue;
 		}