[PATCH v2 1/6] mm/migrate: introduce migrate_pfn_to_folio()

From: Sidhartha Kumar
Date: Fri Feb 16 2024 - 16:13:51 EST


Add a folio compatible wrapper for migrate_pfn_to_page() so we can
return a folio directly.

Signed-off-by: Sidhartha Kumar <sidhartha.kumar@xxxxxxxxxx>
Suggested-by: Alistair Popple <apopple@xxxxxxxxxx>
---
include/linux/migrate.h | 5 +++++
1 file changed, 5 insertions(+)

diff --git a/include/linux/migrate.h b/include/linux/migrate.h
index 2ce13e8a309bd..21a1a5e415338 100644
--- a/include/linux/migrate.h
+++ b/include/linux/migrate.h
@@ -171,6 +171,11 @@ static inline struct page *migrate_pfn_to_page(unsigned long mpfn)
return pfn_to_page(mpfn >> MIGRATE_PFN_SHIFT);
}

+static inline struct folio *migrate_pfn_to_folio(unsigned long mpfn)
+{
+ return page_folio(migrate_pfn_to_page(mpfn));
+}
+
static inline unsigned long migrate_pfn(unsigned long pfn)
{
return (pfn << MIGRATE_PFN_SHIFT) | MIGRATE_PFN_VALID;
--
2.42.0