All of lore.kernel.org
 help / color / mirror / Atom feed
* + mm-allow-compound-zone-device-pages-fix.patch added to mm-unstable branch
@ 2025-02-20  0:00 Andrew Morton
  0 siblings, 0 replies; only message in thread
From: Andrew Morton @ 2025-02-20  0:00 UTC (permalink / raw)
  To: mm-commits, jgg, david, dan.j.williams, apopple, balbirs, akpm


The patch titled
     Subject: mm/migrate_device: do not access pgmap for non zone device pages
has been added to the -mm mm-unstable branch.  Its filename is
     mm-allow-compound-zone-device-pages-fix.patch

This patch will shortly appear at
     https://git.kernel.org/pub/scm/linux/kernel/git/akpm/25-new.git/tree/patches/mm-allow-compound-zone-device-pages-fix.patch

This patch will later appear in the mm-unstable branch at
    git://git.kernel.org/pub/scm/linux/kernel/git/akpm/mm

Before you just go and hit "reply", please:
   a) Consider who else should be cc'ed
   b) Prefer to cc a suitable mailing list as well
   c) Ideally: find the original patch on the mailing list and do a
      reply-to-all to that, adding suitable additional cc's

*** Remember to use Documentation/process/submit-checklist.rst when testing your code ***

The -mm tree is included into linux-next via the mm-everything
branch at git://git.kernel.org/pub/scm/linux/kernel/git/akpm/mm
and is updated there every 2-3 working days

------------------------------------------------------
From: Balbir Singh <balbirs@nvidia.com>
Subject: mm/migrate_device: do not access pgmap for non zone device pages
Date: Thu, 20 Feb 2025 10:13:37 +1100

page_pgmap() is referenced before checking if the page is a zone device
page and this triggers the warning in page_pgmap().  Refactor the code to
use the helper function after relevant checks.

Link: https://lkml.kernel.org/r/20250219231337.364133-1-balbirs@nvidia.com
Signed-off-by: Balbir Singh <balbirs@nvidia.com>
Cc: Alistair Popple <apopple@nvidia.com>
Cc: Jason Gunthorpe <jgg@ziepe.ca>
Cc: David Hildenbrand <david@redhat.com>
Cc: Dan Williams <dan.j.williams@intel.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
---

 mm/migrate_device.c |   13 ++++++++-----
 1 file changed, 8 insertions(+), 5 deletions(-)

--- a/mm/migrate_device.c~mm-allow-compound-zone-device-pages-fix
+++ a/mm/migrate_device.c
@@ -153,14 +153,17 @@ again:
 				goto next;
 			}
 			page = vm_normal_page(migrate->vma, addr, pte);
-			pgmap = page_pgmap(page);
 			if (page && !is_zone_device_page(page) &&
 			    !(migrate->flags & MIGRATE_VMA_SELECT_SYSTEM))
 				goto next;
-			else if (page && is_device_coherent_page(page) &&
-			    (!(migrate->flags & MIGRATE_VMA_SELECT_DEVICE_COHERENT) ||
-			     pgmap->owner != migrate->pgmap_owner))
-				goto next;
+			else if (page && is_device_coherent_page(page)) {
+				pgmap = page_pgmap(page);
+
+				if (!(migrate->flags &
+					MIGRATE_VMA_SELECT_DEVICE_COHERENT) ||
+					pgmap->owner != migrate->pgmap_owner)
+					goto next;
+			}
 			mpfn = migrate_pfn(pfn) | MIGRATE_PFN_MIGRATE;
 			mpfn |= pte_write(pte) ? MIGRATE_PFN_WRITE : 0;
 		}
_

Patches currently in -mm which might be from balbirs@nvidia.com are

mm-allow-compound-zone-device-pages-fix.patch


^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2025-02-20  0:00 UTC | newest]

Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-02-20  0:00 + mm-allow-compound-zone-device-pages-fix.patch added to mm-unstable branch Andrew Morton

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.