diff options
author | Kefeng Wang <[email protected]> | 2024-08-26 14:58:10 +0800 |
---|---|---|
committer | Andrew Morton <[email protected]> | 2024-09-09 16:38:58 -0700 |
commit | 53456b7b3f4c3427ff04ae5c92e6dba1b9bfbb23 (patch) | |
tree | 89e97d12a0c6e7599d30b496cb73c4352ab3bbab | |
parent | 5c8525a37b78ddfee84ff6927b8838013ff2521e (diff) |
mm: migrate_device: use a folio in migrate_device_range()
Save two calls to compound_head() and use folio throughout.
Link: https://lkml.kernel.org/r/[email protected]
Signed-off-by: Kefeng Wang <[email protected]>
Acked-by: David Hildenbrand <[email protected]>
Reviewed-by: Vishal Moola (Oracle) <[email protected]>
Reviewed-by: Alistair Popple <[email protected]>
Cc: Baolin Wang <[email protected]>
Cc: Jonathan Corbet <[email protected]>
Cc: Matthew Wilcox (Oracle) <[email protected]>
Cc: Zi Yan <[email protected]>
Signed-off-by: Andrew Morton <[email protected]>
-rw-r--r-- | mm/migrate_device.c | 9 |
1 files changed, 5 insertions, 4 deletions
diff --git a/mm/migrate_device.c b/mm/migrate_device.c index 82d75205dda8..66db28b89f9b 100644 --- a/mm/migrate_device.c +++ b/mm/migrate_device.c @@ -898,16 +898,17 @@ 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; - if (!get_page_unless_zero(page)) { + folio = folio_get_nontail_page(pfn_to_page(pfn)); + if (!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; } |