On Fri, Feb 16, 2024 at 01:13:18PM -0800, Sidhartha Kumar wrote: > Use migrate_pfn_to_folio() so we can work with folios directly in > __migrate_device_pages(). i don't understand why this would be correct if we have multipage folios. > @@ -719,33 +719,29 @@ static void __migrate_device_pages(unsigned long *src_pfns, > migrate->pgmap_owner); > mmu_notifier_invalidate_range_start(&range); > } > - migrate_vma_insert_page(migrate, addr, newpage, > + migrate_vma_insert_page(migrate, addr, &dst->page, seems to me that a migration pfn is going to refer to a precise page. now you're telling it to insert the head page of the folio. isn't this wrong? > @@ -753,13 +749,11 @@ static void __migrate_device_pages(unsigned long *src_pfns, > continue; > } > > - if (migrate && migrate->fault_page == page) > - r = migrate_folio_extra(mapping, page_folio(newpage), > - page_folio(page), > - MIGRATE_SYNC_NO_COPY, 1); > + if (migrate && migrate->fault_page == &src->page) shouldn't this rather be "page_folio(migrate->fault_page) == src"? ie we're looking for two pages from the same folio, rather than the page being the same as the head page of the folio?