[PATCH v1 04/15] mm: add device coherent checker to remove migration pte
Alex Sierra
alex.sierra at amd.com
Thu May 5 21:34:27 UTC 2022
During remove_migration_pte(), entries for device coherent type pages
that were not created through special migration ptes, ignore _PAGE_RW
flag. This path can be found at migrate_device_page(), where valid
vma is not required. In this case, migrate_vma_collect_pmd() is not
called and special migration ptes are not set.
Signed-off-by: Alex Sierra <alex.sierra at amd.com>
---
mm/migrate.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/mm/migrate.c b/mm/migrate.c
index 6c31ee1e1c9b..e18ddee56f37 100644
--- a/mm/migrate.c
+++ b/mm/migrate.c
@@ -206,7 +206,8 @@ static bool remove_migration_pte(struct folio *folio,
* Recheck VMA as permissions can change since migration started
*/
entry = pte_to_swp_entry(*pvmw.pte);
- if (is_writable_migration_entry(entry))
+ if (is_writable_migration_entry(entry) ||
+ is_device_coherent_page(pfn_to_page(pvmw.pfn)))
pte = maybe_mkwrite(pte, vma);
else if (pte_swp_uffd_wp(*pvmw.pte))
pte = pte_mkuffd_wp(pte);
--
2.32.0
More information about the amd-gfx
mailing list