svn commit: r314305 - stable/11/sys/amd64/amd64

Alan Cox alc at FreeBSD.org
Sun Feb 26 18:17:13 UTC 2017


Author: alc
Date: Sun Feb 26 18:17:12 2017
New Revision: 314305
URL: https://svnweb.freebsd.org/changeset/base/314305

Log:
  MFC r313960
    In pmap_enter(), set the PG_MANAGED flag on the new PTE in one place,
    rather two places, and do so before the pmap lock is acquired.

Modified:
  stable/11/sys/amd64/amd64/pmap.c
Directory Properties:
  stable/11/   (props changed)

Modified: stable/11/sys/amd64/amd64/pmap.c
==============================================================================
--- stable/11/sys/amd64/amd64/pmap.c	Sun Feb 26 16:34:58 2017	(r314304)
+++ stable/11/sys/amd64/amd64/pmap.c	Sun Feb 26 18:17:12 2017	(r314305)
@@ -4367,7 +4367,8 @@ pmap_enter(pmap_t pmap, vm_offset_t va, 
 	if ((m->oflags & VPO_UNMANAGED) != 0) {
 		if ((newpte & PG_RW) != 0)
 			newpte |= PG_M;
-	}
+	} else
+		newpte |= PG_MANAGED;
 
 	mpte = NULL;
 
@@ -4440,11 +4441,9 @@ retry:
 			/*
 			 * No, might be a protection or wiring change.
 			 */
-			if ((origpte & PG_MANAGED) != 0) {
-				newpte |= PG_MANAGED;
-				if ((newpte & PG_RW) != 0)
-					vm_page_aflag_set(m, PGA_WRITEABLE);
-			}
+			if ((origpte & PG_MANAGED) != 0 &&
+			    (newpte & PG_RW) != 0)
+				vm_page_aflag_set(m, PGA_WRITEABLE);
 			if (((origpte ^ newpte) & ~(PG_M | PG_A)) == 0)
 				goto unchanged;
 			goto validate;
@@ -4461,8 +4460,7 @@ retry:
 	/*
 	 * Enter on the PV list if part of our managed memory.
 	 */
-	if ((m->oflags & VPO_UNMANAGED) == 0) {
-		newpte |= PG_MANAGED;
+	if ((newpte & PG_MANAGED) != 0) {
 		pv = get_pv_entry(pmap, &lock);
 		pv->pv_va = va;
 		CHANGE_PV_LIST_LOCK_TO_PHYS(&lock, pa);


More information about the svn-src-all mailing list