[PATCH 2/2] mm/memory_hotplug: remove head page reference in scan_movable_pages()

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Remove one user of the Huge Page macros which take in a page. Also remove
a reference to a head page variable by using a folio instead.

Signed-off-by: Sidhartha Kumar <sidhartha.kumar@xxxxxxxxxx>
---
 mm/memory_hotplug.c | 11 ++++++-----
 1 file changed, 6 insertions(+), 5 deletions(-)

diff --git a/mm/memory_hotplug.c b/mm/memory_hotplug.c
index ad09189786b1..d5a0672cdf3a 100644
--- a/mm/memory_hotplug.c
+++ b/mm/memory_hotplug.c
@@ -1579,7 +1579,8 @@ static int scan_movable_pages(unsigned long start, unsigned long end,
 	unsigned long pfn;
 
 	for (pfn = start; pfn < end; pfn++) {
-		struct page *page, *head;
+		struct page *page;
+		struct folio *folio;
 		unsigned long skip;
 
 		if (!pfn_valid(pfn))
@@ -1599,9 +1600,9 @@ static int scan_movable_pages(unsigned long start, unsigned long end,
 		if (PageOffline(page) && page_count(page))
 			return -EBUSY;
 
-		if (!PageHuge(page))
+		folio = page_folio(page);
+		if (!folio_test_hugetlb(folio))
 			continue;
-		head = compound_head(page);
 		/*
 		 * This test is racy as we hold no reference or lock.  The
 		 * hugetlb page could have been free'ed and head is no longer
@@ -1609,9 +1610,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) - (page - head);
+		skip = folio_nr_pages(folio) - (page - &folio->page);
 		pfn += skip - 1;
 	}
 	return -ENOENT;
-- 
2.39.1





[Index of Archives]     [Linux ARM Kernel]     [Linux ARM]     [Linux Omap]     [Fedora ARM]     [IETF Annouce]     [Bugtraq]     [Linux OMAP]     [Linux MIPS]     [eCos]     [Asterisk Internet PBX]     [Linux API]

  Powered by Linux