Save two calls to compound_head() and use folio throughout. Signed-off-by: Kefeng Wang <wangkefeng.wang@xxxxxxxxxx> --- mm/migrate_device.c | 9 +++++---- 1 file 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; } -- 2.27.0