Intel-XE Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: Jordan Niethe <jniethe@nvidia.com>
To: intel-xe@lists.freedesktop.org
Cc: matthew.brost@intel.com
Subject: [RESENDv2 v2 09/11] mm/util: Add flag to track device private pages in page snapshots
Date: Thu,  8 Jan 2026 17:01:00 +1100	[thread overview]
Message-ID: <20260108060102.41357-10-jniethe@nvidia.com> (raw)
In-Reply-To: <20260108060102.41357-1-jniethe@nvidia.com>

A future change will remove device private pages from the physical
address space. This will mean that device private pages no longer have
normal pfns and must be handled separately.

Add a new flag PAGE_SNAPSHOT_DEVICE_PRIVATE to track when the pfn of a
page snapshot is a device private page.

Signed-off-by: Jordan Niethe <jniethe@nvidia.com>
Signed-off-by: Alistair Popple <apopple@nvidia.com>
---
 fs/proc/page.c     | 6 ++++--
 include/linux/mm.h | 7 ++++---
 mm/util.c          | 3 +++
 3 files changed, 11 insertions(+), 5 deletions(-)

diff --git a/fs/proc/page.c b/fs/proc/page.c
index f9b2c2c906cd..adca0e681442 100644
--- a/fs/proc/page.c
+++ b/fs/proc/page.c
@@ -191,10 +191,12 @@ u64 stable_page_flags(const struct page *page)
 	         folio_test_large_rmappable(folio)) {
 		/* Note: we indicate any THPs here, not just PMD-sized ones */
 		u |= 1 << KPF_THP;
-	} else if (is_huge_zero_pfn(ps.pfn)) {
+	} else if (!(ps.flags & PAGE_SNAPSHOT_DEVICE_PRIVATE) &&
+		   is_huge_zero_pfn(ps.pfn)) {
 		u |= 1 << KPF_ZERO_PAGE;
 		u |= 1 << KPF_THP;
-	} else if (is_zero_pfn(ps.pfn)) {
+	} else if (!(ps.flags & PAGE_SNAPSHOT_DEVICE_PRIVATE)
+		   && is_zero_pfn(ps.pfn)) {
 		u |= 1 << KPF_ZERO_PAGE;
 	}
 
diff --git a/include/linux/mm.h b/include/linux/mm.h
index 6f959d8ca4b4..9fe63fc38155 100644
--- a/include/linux/mm.h
+++ b/include/linux/mm.h
@@ -4623,9 +4623,10 @@ static inline bool page_pool_page_is_pp(const struct page *page)
 }
 #endif
 
-#define PAGE_SNAPSHOT_FAITHFUL (1 << 0)
-#define PAGE_SNAPSHOT_PG_BUDDY (1 << 1)
-#define PAGE_SNAPSHOT_PG_IDLE  (1 << 2)
+#define PAGE_SNAPSHOT_FAITHFUL		(1 << 0)
+#define PAGE_SNAPSHOT_PG_BUDDY		(1 << 1)
+#define PAGE_SNAPSHOT_PG_IDLE		(1 << 2)
+#define PAGE_SNAPSHOT_DEVICE_PRIVATE	(1 << 3)
 
 struct page_snapshot {
 	struct folio folio_snapshot;
diff --git a/mm/util.c b/mm/util.c
index 97cae40c0209..65e3f1a97d76 100644
--- a/mm/util.c
+++ b/mm/util.c
@@ -1218,6 +1218,9 @@ static void set_ps_flags(struct page_snapshot *ps, const struct folio *folio,
 
 	if (folio_test_idle(folio))
 		ps->flags |= PAGE_SNAPSHOT_PG_IDLE;
+
+	if (is_device_private_page(page))
+		ps->flags |= PAGE_SNAPSHOT_DEVICE_PRIVATE;
 }
 
 /**
-- 
2.34.1


  parent reply	other threads:[~2026-01-08  6:01 UTC|newest]

Thread overview: 20+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-01-08  6:00 [RESENDv2 v2 00/11] Remove device private pages from physical address space Jordan Niethe
2026-01-08  6:00 ` [RESENDv2 v2 01/11] mm/migrate_device: Introduce migrate_pfn_from_page() helper Jordan Niethe
2026-01-08  6:00 ` [RESENDv2 v2 02/11] drm/amdkfd: Use migrate pfns internally Jordan Niethe
2026-01-08  6:00 ` [RESENDv2 v2 03/11] mm/migrate_device: Make migrate_device_{pfns, range}() take mpfns Jordan Niethe
2026-01-08  6:00 ` [RESENDv2 v2 04/11] mm/migrate_device: Add migrate PFN flag to track device private pages Jordan Niethe
2026-01-08  6:00 ` [RESENDv2 v2 05/11] mm/page_vma_mapped: Add flags to page_vma_mapped_walk::pfn " Jordan Niethe
2026-01-08  6:00 ` [RESENDv2 v2 06/11] mm: Add helpers to create migration entries from struct pages Jordan Niethe
2026-01-08  6:00 ` [RESENDv2 v2 07/11] mm: Add a new swap type for migration entries of device private pages Jordan Niethe
2026-01-08 19:08   ` Lorenzo Stoakes
2026-01-08 23:39     ` Jordan Niethe
2026-01-09 11:32       ` Lorenzo Stoakes
2026-01-12  1:05         ` Jordan Niethe
2026-01-08  6:00 ` [RESENDv2 v2 08/11] mm: Add helpers to create device private entries from struct pages Jordan Niethe
2026-01-08  6:01 ` Jordan Niethe [this message]
2026-01-08  6:01 ` [RESENDv2 v2 10/11] mm/hmm: Add flag to track device private pages Jordan Niethe
2026-01-08  6:01 ` [RESENDv2 v2 11/11] mm: Remove device private pages from the physical address space Jordan Niethe
2026-01-08  6:10 ` ✗ CI.checkpatch: warning for Remove device private pages from physical address space (rev4) Patchwork
2026-01-08  6:11 ` ✓ CI.KUnit: success " Patchwork
2026-01-08  7:05 ` ✗ Xe.CI.BAT: failure " Patchwork
2026-01-08  8:24 ` ✗ Xe.CI.Full: " Patchwork

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20260108060102.41357-10-jniethe@nvidia.com \
    --to=jniethe@nvidia.com \
    --cc=intel-xe@lists.freedesktop.org \
    --cc=matthew.brost@intel.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox