mm/migrate_device: return number of migrating pages in args->cpages
migrate_vma->cpages originally contained a count of the number of pages migrating including non-present pages which can be populated directly on the target. Commit241f688596
("mm/migrate_device.c: refactor migrate_vma and migrate_device_coherent_page()") inadvertantly changed this to contain just the number of pages that were unmapped. Usage of migrate_vma->cpages isn't documented, but most drivers use it to see if all the requested addresses can be migrated so restore the original behaviour. Link: https://lkml.kernel.org/r/20221111005135.1344004-1-apopple@nvidia.com Fixes:241f688596
("mm/migrate_device.c: refactor migrate_vma and migrate_deivce_coherent_page()") Signed-off-by: Alistair Popple <apopple@nvidia.com> Reported-by: Ralph Campbell <rcampbell@nvidia.com> Reviewed-by: Ralph Campbell <rcampbell@nvidia.com> Cc: John Hubbard <jhubbard@nvidia.com> Cc: Alex Sierra <alex.sierra@amd.com> Cc: Ben Skeggs <bskeggs@redhat.com> Cc: Felix Kuehling <Felix.Kuehling@amd.com> Cc: Lyude Paul <lyude@redhat.com> Cc: Jason Gunthorpe <jgg@nvidia.com> Cc: Michael Ellerman <mpe@ellerman.id.au> Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
This commit is contained in:
parent
50c697215a
commit
44af0b45d5
|
@ -357,7 +357,8 @@ static bool migrate_vma_check_page(struct page *page, struct page *fault_page)
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Unmaps pages for migration. Returns number of unmapped pages.
|
* Unmaps pages for migration. Returns number of source pfns marked as
|
||||||
|
* migrating.
|
||||||
*/
|
*/
|
||||||
static unsigned long migrate_device_unmap(unsigned long *src_pfns,
|
static unsigned long migrate_device_unmap(unsigned long *src_pfns,
|
||||||
unsigned long npages,
|
unsigned long npages,
|
||||||
|
@ -373,8 +374,11 @@ static unsigned long migrate_device_unmap(unsigned long *src_pfns,
|
||||||
struct page *page = migrate_pfn_to_page(src_pfns[i]);
|
struct page *page = migrate_pfn_to_page(src_pfns[i]);
|
||||||
struct folio *folio;
|
struct folio *folio;
|
||||||
|
|
||||||
if (!page)
|
if (!page) {
|
||||||
|
if (src_pfns[i] & MIGRATE_PFN_MIGRATE)
|
||||||
|
unmapped++;
|
||||||
continue;
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
/* ZONE_DEVICE pages are not on LRU */
|
/* ZONE_DEVICE pages are not on LRU */
|
||||||
if (!is_zone_device_page(page)) {
|
if (!is_zone_device_page(page)) {
|
||||||
|
|
Loading…
Reference in New Issue