mm/migrate_device: Return number of migrating pages in args->cpages
Subsystems (2)
Alistair Popple
reviewerPATCH 1/1 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 poluated directly on the target.
Commit 241f68859656 ("mm/migrate_device.c: refactor migrate_vma and migrate_deivce_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.
---
Hi Andrew, hoping you can merge this small fix which Ralph reported to me for v6.1-rcX.
--- mm/migrate_device.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-)
mm/migrate_device.c +6 -2
@@ -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, 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 folio *folio; -if (!page) +if (!page) { +if (src_pfns[i] &MIGRATE_PFN_MIGRATE ) + unmapped++;continue ; + }/* ZONE_DEVICE pages are not on LRU */ if (!is_zone_device_page (page)) {
Signature · 1 line
2.35.1
Quoted 2 lines · Alistair Popple
migrate_vma->cpagesoriginally contained a count of the number of pages migrating including non-present pages which can be poluated
"populated"
Quoted 9 lines
directly on the target.
Commit
241f68859656("mm/migrate_device.c: refactormigrate_vmaandmigrate_deivce_coherent_page()") inadvertantly changed this to contain just the number of pages that were unmapped. Usage ofmigrate_vma->cpagesisn't documented, but most drivers use it to see if all the requested addresses can be migrated so restore the original behaviour.
Quoted 3 lines
Fixes 241f68859656 ("mm/migrate_device.c: refactor migrate_vma and migrate_deivce_coherent_page()")Signed-off-by Alistair Popple <[email protected]>Reported-by Ralph Campbell <[email protected]>
You can add
Thanks!
Alistair Popple
reviewerHi Andrew,
I realize it's getting late in the cycle but any chance you could take this one as well for v6.1-rc6? It fixes a minor bug introduced in v6.1-rc1 which could cause some drivers to think they can't migrate pages when they can. Thanks.
Quoted 23 lines · Ralph Campbell
Quoted 2 lines · Alistair Popple
migrate_vma->cpagesoriginally contained a count of the number of pages migrating including non-present pages which can be poluated"populated"
Quoted 9 lines
directly on the target.
Commit
241f68859656("mm/migrate_device.c: refactormigrate_vmaandmigrate_deivce_coherent_page()") inadvertantly changed this to contain just the number of pages that were unmapped. Usage ofmigrate_vma->cpagesisn't documented, but most drivers use it to see if all the requested addresses can be migrated so restore the original behaviour.Quoted 3 lines
Fixes 241f68859656 ("mm/migrate_device.c: refactor migrate_vma and migrate_deivce_coherent_page()")Signed-off-by Alistair Popple <[email protected]>Reported-by Ralph Campbell <[email protected]>You can add
Reviewed-by Ralph Campbell <[email protected]>Thanks!