Skip to content

Commit 3d321bf

Browse files
Ralph Campbelltorvalds
authored andcommitted
mm/migrate: preserve soft dirty in remove_migration_pte()
The code to remove a migration PTE and replace it with a device private PTE was not copying the soft dirty bit from the migration entry. This could lead to page contents not being marked dirty when faulting the page back from device private memory. Signed-off-by: Ralph Campbell <rcampbell@nvidia.com> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Reviewed-by: Christoph Hellwig <hch@lst.de> Cc: Jerome Glisse <jglisse@redhat.com> Cc: Alistair Popple <apopple@nvidia.com> Cc: Christoph Hellwig <hch@lst.de> Cc: Jason Gunthorpe <jgg@nvidia.com> Cc: Bharata B Rao <bharata@linux.ibm.com> Link: https://lkml.kernel.org/r/20200831212222.22409-3-rcampbell@nvidia.com Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
1 parent 6128763 commit 3d321bf

1 file changed

Lines changed: 2 additions & 0 deletions

File tree

mm/migrate.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -249,6 +249,8 @@ static bool remove_migration_pte(struct page *page, struct vm_area_struct *vma,
249249
if (unlikely(is_device_private_page(new))) {
250250
entry = make_device_private_entry(new, pte_write(pte));
251251
pte = swp_entry_to_pte(entry);
252+
if (pte_swp_soft_dirty(*pvmw.pte))
253+
pte = pte_swp_mksoft_dirty(pte);
252254
if (pte_swp_uffd_wp(*pvmw.pte))
253255
pte = pte_swp_mkuffd_wp(pte);
254256
}

0 commit comments

Comments
 (0)