Re: [PATCH v2 2/6] mm/migrate_device: further convert migrate_device_unmap() to folios

From: Matthew Wilcox
Date: Fri Feb 16 2024 - 16:51:41 EST


On Fri, Feb 16, 2024 at 01:13:16PM -0800, Sidhartha Kumar wrote:
> migrate_device_unmap() already has a folio, we can use the folio
> versions of is_zone_device_page() and putback_lru_page.
> - if (page_mapped(page) ||
> - !migrate_vma_check_page(page, fault_page)) {
> - if (!is_zone_device_page(page)) {
> - get_page(page);
> - putback_lru_page(page);
> + if (folio_mapped(folio) ||
> + !migrate_vma_check_page(&folio->page, fault_page)) {
> + if (!folio_is_zone_device(folio)) {
> + folio_get(folio);
> + folio_putback_lru(folio);

page_mapped() is not the same thing as folio_mapped(page_folio(page)).
please include some argumentation about why this is a correct
transformation to make.