* [PATCH] mm/migrate_device: Return number of migrating pages in args->cpages
@ 2022-11-11 0:51 Alistair Popple
2022-11-14 23:58 ` Ralph Campbell
0 siblings, 1 reply; 3+ messages in thread
From: Alistair Popple @ 2022-11-11 0:51 UTC (permalink / raw)
To: linux-mm, Andrew Morton
Cc: dri-devel, Alistair Popple, Ralph Campbell, John Hubbard,
Alex Sierra, Ben Skeggs, Felix Kuehling, Lyude Paul,
Jason Gunthorpe, Michael Ellerman
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.
Fixes: 241f68859656 ("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>
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>
---
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(-)
diff --git a/mm/migrate_device.c b/mm/migrate_device.c
index 6fa682eef7a0..721b2365dbca 100644
--- a/mm/migrate_device.c
+++ b/mm/migrate_device.c
@@ -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)) {
--
2.35.1
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH] mm/migrate_device: Return number of migrating pages in args->cpages
2022-11-11 0:51 [PATCH] mm/migrate_device: Return number of migrating pages in args->cpages Alistair Popple
@ 2022-11-14 23:58 ` Ralph Campbell
2022-11-16 11:59 ` Alistair Popple
0 siblings, 1 reply; 3+ messages in thread
From: Ralph Campbell @ 2022-11-14 23:58 UTC (permalink / raw)
To: Alistair Popple, linux-mm, Andrew Morton
Cc: dri-devel, John Hubbard, Alex Sierra, Ben Skeggs, Felix Kuehling,
Lyude Paul, Jason Gunthorpe, Michael Ellerman
On 11/10/22 16:51, Alistair Popple wrote:
> migrate_vma->cpages originally contained a count of the number of
> pages migrating including non-present pages which can be poluated
"populated"
> 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.
>
> Fixes: 241f68859656 ("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>
You can add
Reviewed-by: Ralph Campbell <rcampbell@nvidia.com>
Thanks!
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH] mm/migrate_device: Return number of migrating pages in args->cpages
2022-11-14 23:58 ` Ralph Campbell
@ 2022-11-16 11:59 ` Alistair Popple
0 siblings, 0 replies; 3+ messages in thread
From: Alistair Popple @ 2022-11-16 11:59 UTC (permalink / raw)
To: Ralph Campbell
Cc: linux-mm, Andrew Morton, dri-devel, John Hubbard, Alex Sierra,
Ben Skeggs, Felix Kuehling, Lyude Paul, Jason Gunthorpe,
Michael Ellerman
Hi 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.
Ralph Campbell <rcampbell@nvidia.com> writes:
> On 11/10/22 16:51, Alistair Popple wrote:
>> migrate_vma->cpages originally contained a count of the number of
>> pages migrating including non-present pages which can be poluated
>
> "populated"
>
>> 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.
>>
>> Fixes: 241f68859656 ("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>
>
> You can add
> Reviewed-by: Ralph Campbell <rcampbell@nvidia.com>
>
> Thanks!
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2022-11-16 12:14 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-11-11 0:51 [PATCH] mm/migrate_device: Return number of migrating pages in args->cpages Alistair Popple
2022-11-14 23:58 ` Ralph Campbell
2022-11-16 11:59 ` Alistair Popple
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox