mirror of
https://github.com/torvalds/linux.git
synced 2025-12-01 07:26:02 +07:00
mm: migrate_device: use a newfolio in __migrate_device_pages()
Use a newfolio instead of newpage and convert to more folio api in __migrate_device_pages(). Link: https://lkml.kernel.org/r/20240524052843.182275-3-wangkefeng.wang@huawei.com Signed-off-by: Kefeng Wang <wangkefeng.wang@huawei.com> Reviewed-by: Matthew Wilcox (Oracle) <willy@infradead.org> Reviewed-by: Vishal Moola (Oracle) <vishal.moola@gmail.com> Reviewed-by: Miaohe Lin <linmiaohe@huawei.com> Cc: Alistair Popple <apopple@nvidia.com> Cc: Benjamin LaHaise <bcrl@kvack.org> Cc: David Hildenbrand <david@redhat.com> Cc: Hugh Dickins <hughd@google.com> Cc: Jérôme Glisse <jglisse@redhat.com> Cc: Jiaqi Yan <jiaqiyan@google.com> Cc: Muchun Song <muchun.song@linux.dev> Cc: Naoya Horiguchi <nao.horiguchi@gmail.com> Cc: Tony Luck <tony.luck@intel.com> Cc: Zi Yan <ziy@nvidia.com> Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
This commit is contained in:
committed by
Andrew Morton
parent
01878f10f8
commit
6aaaef5b6f
@@ -692,7 +692,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;
|
||||
struct folio *newfolio, *folio;
|
||||
int r;
|
||||
|
||||
if (!newpage) {
|
||||
@@ -727,11 +727,12 @@ static void __migrate_device_pages(unsigned long *src_pfns,
|
||||
continue;
|
||||
}
|
||||
|
||||
newfolio = page_folio(newpage);
|
||||
folio = page_folio(page);
|
||||
mapping = folio_mapping(folio);
|
||||
|
||||
if (is_device_private_page(newpage) ||
|
||||
is_device_coherent_page(newpage)) {
|
||||
if (folio_is_device_private(newfolio) ||
|
||||
folio_is_device_coherent(newfolio)) {
|
||||
if (mapping) {
|
||||
/*
|
||||
* For now only support anonymous memory migrating to
|
||||
@@ -745,7 +746,7 @@ static void __migrate_device_pages(unsigned long *src_pfns,
|
||||
continue;
|
||||
}
|
||||
}
|
||||
} else if (is_zone_device_page(newpage)) {
|
||||
} else if (folio_is_zone_device(newfolio)) {
|
||||
/*
|
||||
* Other types of ZONE_DEVICE page are not supported.
|
||||
*/
|
||||
@@ -754,11 +755,11 @@ static void __migrate_device_pages(unsigned long *src_pfns,
|
||||
}
|
||||
|
||||
if (migrate && migrate->fault_page == page)
|
||||
r = migrate_folio_extra(mapping, page_folio(newpage),
|
||||
folio, MIGRATE_SYNC_NO_COPY, 1);
|
||||
r = migrate_folio_extra(mapping, newfolio, folio,
|
||||
MIGRATE_SYNC_NO_COPY, 1);
|
||||
else
|
||||
r = migrate_folio(mapping, page_folio(newpage),
|
||||
folio, MIGRATE_SYNC_NO_COPY);
|
||||
r = migrate_folio(mapping, newfolio, folio,
|
||||
MIGRATE_SYNC_NO_COPY);
|
||||
if (r != MIGRATEPAGE_SUCCESS)
|
||||
src_pfns[i] &= ~MIGRATE_PFN_MIGRATE;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user