Skip to content

Commit 6128763

Browse files
Ralph Campbelltorvalds
authored andcommitted
mm/migrate: remove unnecessary is_zone_device_page() check
Patch series "mm/migrate: preserve soft dirty in remove_migration_pte()". I happened to notice this from code inspection after seeing Alistair Popple's patch ("mm/rmap: Fixup copying of soft dirty and uffd ptes"). This patch (of 2): The check for is_zone_device_page() and is_device_private_page() is unnecessary since the latter is sufficient to determine if the page is a device private page. Simplify the code for easier reading. 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-1-rcampbell@nvidia.com Link: https://lkml.kernel.org/r/20200831212222.22409-2-rcampbell@nvidia.com Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
1 parent ad7df76 commit 6128763

1 file changed

Lines changed: 5 additions & 7 deletions

File tree

mm/migrate.c

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -246,13 +246,11 @@ static bool remove_migration_pte(struct page *page, struct vm_area_struct *vma,
246246
else if (pte_swp_uffd_wp(*pvmw.pte))
247247
pte = pte_mkuffd_wp(pte);
248248

249-
if (unlikely(is_zone_device_page(new))) {
250-
if (is_device_private_page(new)) {
251-
entry = make_device_private_entry(new, pte_write(pte));
252-
pte = swp_entry_to_pte(entry);
253-
if (pte_swp_uffd_wp(*pvmw.pte))
254-
pte = pte_swp_mkuffd_wp(pte);
255-
}
249+
if (unlikely(is_device_private_page(new))) {
250+
entry = make_device_private_entry(new, pte_write(pte));
251+
pte = swp_entry_to_pte(entry);
252+
if (pte_swp_uffd_wp(*pvmw.pte))
253+
pte = pte_swp_mkuffd_wp(pte);
256254
}
257255

258256
#ifdef CONFIG_HUGETLB_PAGE

0 commit comments

Comments
 (0)