Re: [PATCH] mm/hugetlb: mm/memory_hotplug: use a folio in scan_movable_pages()

From: Matthew Wilcox
Date: Tue May 28 2024 - 18:48:12 EST


On Tue, May 28, 2024 at 03:03:21PM -0700, Sidhartha Kumar wrote:
> @@ -1761,9 +1762,9 @@ static int scan_movable_pages(unsigned long start, unsigned long end,
> * cases false positives and negatives are possible. Calling
> * code must deal with these scenarios.
> */
> - if (HPageMigratable(head))
> + if (folio_test_hugetlb_migratable(folio))
> goto found;
> - skip = compound_nr(head) - (pfn - page_to_pfn(head));
> + skip = folio_nr_pages(folio) - folio_page_idx(folio, page);
> pfn += skip - 1;

Isn't this an unnecessarily complicated way of writing:

pfn |= folio_nr_pages(folio) - 1;
?