mirror of
https://github.com/torvalds/linux.git
synced 2024-11-25 13:41:51 +00:00
migrate: expand the use of folio in __migrate_device_pages()
Removes a few calls to compound_head() and a call to page_mapping(). Link: https://lkml.kernel.org/r/20240423225552.4113447-5-willy@infradead.org Signed-off-by: Matthew Wilcox (Oracle) <willy@infradead.org> Reviewed-by: David Hildenbrand <david@redhat.com> Cc: Eric Biggers <ebiggers@google.com> Cc: Sidhartha Kumar <sidhartha.kumar@oracle.com> Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
This commit is contained in:
parent
89f5c54b22
commit
e18a9faf06
@ -696,6 +696,7 @@ static void __migrate_device_pages(unsigned long *src_pfns,
|
||||
struct page *newpage = migrate_pfn_to_page(dst_pfns[i]);
|
||||
struct page *page = migrate_pfn_to_page(src_pfns[i]);
|
||||
struct address_space *mapping;
|
||||
struct folio *folio;
|
||||
int r;
|
||||
|
||||
if (!newpage) {
|
||||
@ -730,15 +731,12 @@ static void __migrate_device_pages(unsigned long *src_pfns,
|
||||
continue;
|
||||
}
|
||||
|
||||
mapping = page_mapping(page);
|
||||
folio = page_folio(page);
|
||||
mapping = folio_mapping(folio);
|
||||
|
||||
if (is_device_private_page(newpage) ||
|
||||
is_device_coherent_page(newpage)) {
|
||||
if (mapping) {
|
||||
struct folio *folio;
|
||||
|
||||
folio = page_folio(page);
|
||||
|
||||
/*
|
||||
* For now only support anonymous memory migrating to
|
||||
* device private or coherent memory.
|
||||
@ -761,11 +759,10 @@ static void __migrate_device_pages(unsigned long *src_pfns,
|
||||
|
||||
if (migrate && migrate->fault_page == page)
|
||||
r = migrate_folio_extra(mapping, page_folio(newpage),
|
||||
page_folio(page),
|
||||
MIGRATE_SYNC_NO_COPY, 1);
|
||||
folio, MIGRATE_SYNC_NO_COPY, 1);
|
||||
else
|
||||
r = migrate_folio(mapping, page_folio(newpage),
|
||||
page_folio(page), MIGRATE_SYNC_NO_COPY);
|
||||
folio, MIGRATE_SYNC_NO_COPY);
|
||||
if (r != MIGRATEPAGE_SUCCESS)
|
||||
src_pfns[i] &= ~MIGRATE_PFN_MIGRATE;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user