On Mon, Jan 29, 2024 at 03:09:27PM +0800, Kefeng Wang wrote: > Use newfolio/folio for migrate_folio_extra()/migrate_folio() to > save three compound_head() calls. I've looked at this function before and I get stuck on the question of whether a device page truly is a folio or not. I think for the moment, we've decided that it is, so .. Reviewed-by: Matthew Wilcox (Oracle) <willy@xxxxxxxxxxxxx> Although ... > @@ -729,13 +730,12 @@ static void __migrate_device_pages(unsigned long *src_pfns, > } > > mapping = page_mapping(page); > + folio = page_folio(page); > + newfolio = page_folio(newpage); you should save one more call to compound_head() by changing the page_mapping() to folio_mapping().