git: f29a09d97737 - main - vm_page: Replace PGA_EXECUTABLE with PGA_PMAP_PRIV1

From: Alan Cox <alc_at_FreeBSD.org>
Date: Sat, 26 Sep 2026 15:42:35 UTC
The branch main has been updated by alc:

URL: https://cgit.FreeBSD.org/src/commit/?id=f29a09d977378fc8504bf284849fc0438ce29153

commit f29a09d977378fc8504bf284849fc0438ce29153
Author:     Alan Cox <alc@FreeBSD.org>
AuthorDate: 2026-09-25 05:01:09 +0000
Commit:     Alan Cox <alc@FreeBSD.org>
CommitDate: 2026-09-26 15:40:45 +0000

    vm_page: Replace PGA_EXECUTABLE with PGA_PMAP_PRIV1
    
    At present, PGA_EXECUTABLE is only used by the powerpc mmu_oea64 pmap.
    The MI layer only accesses this flag to assert that it is clear when a
    managed page is freed.  Soon, we will need a similar, but not identical,
    machine-dependent flag in the arm64 pmap.  So, we rename this flag to
    PGA_PMAP_PRIV1, simply saying that it is reserved for use by the pmap.
    Each pmap can then define a name that best reflects its own meaning.
    However, we still assert that this flag is clear when a managed page is
    freed.
    
    No functional change.
    
    Reviewed by:    kib, markj
    Differential Revision:  https://reviews.freebsd.org/D59995
---
 sys/powerpc/aim/mmu_oea64.c | 7 +++++++
 sys/vm/vm_page.c            | 2 +-
 sys/vm/vm_page.h            | 7 ++++---
 3 files changed, 12 insertions(+), 4 deletions(-)

diff --git a/sys/powerpc/aim/mmu_oea64.c b/sys/powerpc/aim/mmu_oea64.c
index d8e85a72f4e0..2da692c9caae 100644
--- a/sys/powerpc/aim/mmu_oea64.c
+++ b/sys/powerpc/aim/mmu_oea64.c
@@ -101,6 +101,13 @@
 
 #include "mmu_oea64.h"
 
+/*
+ * PGA_EXECUTABLE is set when an executable mapping of the page is created and
+ * cleared when the page's last mapping is destroyed.  It is used to avoid
+ * redundant synchronization of the instruction cache.
+ */
+#define	PGA_EXECUTABLE	PGA_PMAP_PRIV1
+
 void moea64_release_vsid(uint64_t vsid);
 uintptr_t moea64_get_unique_vsid(void);
 
diff --git a/sys/vm/vm_page.c b/sys/vm/vm_page.c
index 251d01221af7..3369179465de 100644
--- a/sys/vm/vm_page.c
+++ b/sys/vm/vm_page.c
@@ -4120,7 +4120,7 @@ vm_page_free_prep(vm_page_t m)
 	if ((m->oflags & VPO_UNMANAGED) == 0) {
 		KASSERT(!pmap_page_is_mapped(m),
 		    ("vm_page_free_prep: freeing mapped page %p", m));
-		KASSERT((m->a.flags & (PGA_EXECUTABLE | PGA_WRITEABLE)) == 0,
+		KASSERT((m->a.flags & (PGA_PMAP_PRIV1 | PGA_WRITEABLE)) == 0,
 		    ("vm_page_free_prep: mapping flags set in page %p", m));
 	} else {
 		KASSERT(m->a.queue == PQ_NONE,
diff --git a/sys/vm/vm_page.h b/sys/vm/vm_page.h
index 1c92ccdaf7ea..ee7bcf900b76 100644
--- a/sys/vm/vm_page.h
+++ b/sys/vm/vm_page.h
@@ -350,8 +350,9 @@ extern vm_page_t bogus_page;
  * exclusive busied.  The MI VM layer must never access this flag
  * directly.  Instead, it should call pmap_page_is_write_mapped().
  *
- * PGA_EXECUTABLE may be set by pmap routines, and indicates that a page has
- * at least one executable mapping.  It is not consumed by the MI VM layer.
+ * PGA_PMAP_PRIV1 is reserved for use by the pmap, which defines its meaning.
+ * The MI VM layer does not consume it, except to assert that it is clear when
+ * a managed page is freed.
  *
  * PGA_NOSYNC must be set and cleared with the page busy lock held.
  *
@@ -383,7 +384,7 @@ extern vm_page_t bogus_page;
  */
 #define	PGA_WRITEABLE	0x0001		/* page may be mapped writeable */
 #define	PGA_REFERENCED	0x0002		/* page has been referenced */
-#define	PGA_EXECUTABLE	0x0004		/* page may be mapped executable */
+#define	PGA_PMAP_PRIV1	0x0004		/* reserved for use by the pmap */
 #define	PGA_ENQUEUED	0x0008		/* page is enqueued in a page queue */
 #define	PGA_DEQUEUE	0x0010		/* page is due to be dequeued */
 #define	PGA_REQUEUE	0x0020		/* page is due to be requeued */