Module Name:    src
Committed By:   thorpej
Date:           Fri Dec 22 19:53:47 UTC 2023

Modified Files:
        src/sys/arch/sun2/sun2: pmap.c
        src/sys/arch/sun3/sun3: pmap.c

Log Message:
pv_link(): Seed pv_flags for the page with PG_MOD and PG_REF if
the caller pre-set those bits in the PTE (which pmap_enter() does,
based on hints from uvm_fault()), avoiding the slow path in
pmap_is_{referenced,modified}().


To generate a diff of this commit:
cvs rdiff -u -r1.50 -r1.51 src/sys/arch/sun2/sun2/pmap.c
cvs rdiff -u -r1.175 -r1.176 src/sys/arch/sun3/sun3/pmap.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/sys/arch/sun2/sun2/pmap.c
diff -u src/sys/arch/sun2/sun2/pmap.c:1.50 src/sys/arch/sun2/sun2/pmap.c:1.51
--- src/sys/arch/sun2/sun2/pmap.c:1.50	Fri Jun  2 08:51:47 2023
+++ src/sys/arch/sun2/sun2/pmap.c	Fri Dec 22 19:53:47 2023
@@ -1,4 +1,4 @@
-/*	$NetBSD: pmap.c,v 1.50 2023/06/02 08:51:47 andvar Exp $	*/
+/*	$NetBSD: pmap.c,v 1.51 2023/12/22 19:53:47 thorpej Exp $	*/
 
 /*-
  * Copyright (c) 1996 The NetBSD Foundation, Inc.
@@ -82,7 +82,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: pmap.c,v 1.50 2023/06/02 08:51:47 andvar Exp $");
+__KERNEL_RCSID(0, "$NetBSD: pmap.c,v 1.51 2023/12/22 19:53:47 thorpej Exp $");
 
 #include "opt_ddb.h"
 #include "opt_pmap_debug.h"
@@ -1349,15 +1349,15 @@ pv_link(pmap_t pmap, int pte, vaddr_t va
 			panic("pv_link: duplicate entry for PA=0x%lx", pa);
 	}
 #endif
-#ifdef HAVECACHE
 
+	/* Only the non-cached bit is of interest here. */
+	int flags = (pte & (PG_NC | PG_MODREF)) >> PV_SHIFT;
+	*pv_flags |= flags;
+
+#ifdef HAVECACHE
 	/*
 	 * Does this new mapping cause VAC alias problems?
 	 */
-	/* Only the non-cached bit is of interest here. */
-	int flags = (pte & PG_NC) ? PV_NC : 0;
-
-	*pv_flags |= flags;
 	if ((*pv_flags & PV_NC) == 0) {
 		for (pv = *head; pv != NULL; pv = pv->pv_next) {
 			if (BADALIAS(va, pv->pv_va)) {

Index: src/sys/arch/sun3/sun3/pmap.c
diff -u src/sys/arch/sun3/sun3/pmap.c:1.175 src/sys/arch/sun3/sun3/pmap.c:1.176
--- src/sys/arch/sun3/sun3/pmap.c:1.175	Sun Dec 17 13:28:59 2023
+++ src/sys/arch/sun3/sun3/pmap.c	Fri Dec 22 19:53:47 2023
@@ -1,4 +1,4 @@
-/*	$NetBSD: pmap.c,v 1.175 2023/12/17 13:28:59 andvar Exp $	*/
+/*	$NetBSD: pmap.c,v 1.176 2023/12/22 19:53:47 thorpej Exp $	*/
 
 /*-
  * Copyright (c) 1996 The NetBSD Foundation, Inc.
@@ -80,7 +80,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: pmap.c,v 1.175 2023/12/17 13:28:59 andvar Exp $");
+__KERNEL_RCSID(0, "$NetBSD: pmap.c,v 1.176 2023/12/22 19:53:47 thorpej Exp $");
 
 #include "opt_ddb.h"
 #include "opt_pmap_debug.h"
@@ -1356,15 +1356,14 @@ pv_link(pmap_t pmap, int pte, vaddr_t va
 			panic("pv_link: duplicate entry for PA=0x%lx", pa);
 	}
 #endif
-#ifdef HAVECACHE
 
+	flags = (pte & (PG_NC | PG_MODREF)) >> PV_SHIFT;
+	*pv_flags |= flags;
+
+#ifdef HAVECACHE
 	/*
 	 * Does this new mapping cause VAC alias problems?
 	 */
-
-	/* Only the non-cached bit is of interest here. */
-	flags = (pte & PG_NC) ? PV_NC : 0;
-	*pv_flags |= flags;
 	if ((*pv_flags & PV_NC) == 0) {
 		for (pv = *head; pv != NULL; pv = pv->pv_next) {
 			if (BADALIAS(va, pv->pv_va)) {

Reply via email to