[v2,6/6] mm/migrate_device: convert migrate_device_range() to folios

Message ID 20240216211320.222431-6-sidhartha.kumar@oracle.com
State New
Headers
Series [v2,1/6] mm/migrate: introduce migrate_pfn_to_folio() |

Commit Message

Sidhartha Kumar Feb. 16, 2024, 9:13 p.m. UTC
  Use pfn_folio() to get a folio and use the folio equivalent page
functions throughout migrate_device_range().

Signed-off-by: Sidhartha Kumar <sidhartha.kumar@oracle.com>
---
 mm/migrate_device.c | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)
  

Patch

diff --git a/mm/migrate_device.c b/mm/migrate_device.c
index 5c239de0f08b2..0c8d86851e631 100644
--- a/mm/migrate_device.c
+++ b/mm/migrate_device.c
@@ -888,16 +888,16 @@  int migrate_device_range(unsigned long *src_pfns, unsigned long start,
 	unsigned long i, pfn;
 
 	for (pfn = start, i = 0; i < npages; pfn++, i++) {
-		struct page *page = pfn_to_page(pfn);
+		struct folio *folio = pfn_folio(pfn);
 
-		if (!get_page_unless_zero(page)) {
+		if (!folio_try_get(folio)) {
 			src_pfns[i] = 0;
 			continue;
 		}
 
-		if (!trylock_page(page)) {
+		if (!folio_trylock(folio)) {
 			src_pfns[i] = 0;
-			put_page(page);
+			folio_put(folio);
 			continue;
 		}