Merge tag 'char-misc-5.9-rc3' of git://git.kernel.org/pub/scm/linux/kernel/git/gregkh...
[linux-2.6-microblaze.git] / mm / memory_hotplug.c
index c32ead8..e9d5ab5 100644 (file)
@@ -1299,7 +1299,7 @@ static int
 do_migrate_range(unsigned long start_pfn, unsigned long end_pfn)
 {
        unsigned long pfn;
-       struct page *page;
+       struct page *page, *head;
        int ret = 0;
        LIST_HEAD(source);
 
@@ -1307,15 +1307,14 @@ do_migrate_range(unsigned long start_pfn, unsigned long end_pfn)
                if (!pfn_valid(pfn))
                        continue;
                page = pfn_to_page(pfn);
+               head = compound_head(page);
 
                if (PageHuge(page)) {
-                       struct page *head = compound_head(page);
                        pfn = page_to_pfn(head) + compound_nr(head) - 1;
                        isolate_huge_page(head, &source);
                        continue;
                } else if (PageTransHuge(page))
-                       pfn = page_to_pfn(compound_head(page))
-                               + hpage_nr_pages(page) - 1;
+                       pfn = page_to_pfn(head) + thp_nr_pages(page) - 1;
 
                /*
                 * HWPoison pages have elevated reference counts so the migration would