svn commit: r365951 - head/sys/amd64/amd64

Konstantin Belousov kib at FreeBSD.org
Mon Sep 21 15:53:42 UTC 2020


Author: kib
Date: Mon Sep 21 15:53:41 2020
New Revision: 365951
URL: https://svnweb.freebsd.org/changeset/base/365951

Log:
  amd64 pmap: only calculate page table page when needed.
  
  Noted by:	alc
  Reviewed by:	alc, markj
  Sponsored by:	The FreeBSD Foundation
  MFC after:	1 week
  Differential revision:	https://reviews.freebsd.org/D26499

Modified:
  head/sys/amd64/amd64/pmap.c

Modified: head/sys/amd64/amd64/pmap.c
==============================================================================
--- head/sys/amd64/amd64/pmap.c	Mon Sep 21 15:49:02 2020	(r365950)
+++ head/sys/amd64/amd64/pmap.c	Mon Sep 21 15:53:41 2020	(r365951)
@@ -6525,12 +6525,13 @@ restart:
 			origpte = *pdpe;
 			MPASS(origpte == 0);
 		} else {
-			mp = PHYS_TO_VM_PAGE(*pml4e & PG_FRAME);
 			pdpe = pmap_pdpe(pmap, va);
 			KASSERT(pdpe != NULL, ("va %#lx lost pdpe", va));
 			origpte = *pdpe;
-			if ((origpte & PG_V) == 0)
+			if ((origpte & PG_V) == 0) {
+				mp = PHYS_TO_VM_PAGE(*pml4e & PG_FRAME);
 				mp->ref_count++;
+			}
 		}
 		KASSERT((origpte & PG_V) == 0 || ((origpte & PG_PS) != 0 &&
 		    (origpte & PG_FRAME) == (pten & PG_FRAME)),
@@ -6563,10 +6564,11 @@ restart:
 		} else {
 			pdpe = pmap_pdpe(pmap, va);
 			MPASS(pdpe != NULL && (*pdpe & PG_V) != 0);
-			mp = PHYS_TO_VM_PAGE(*pdpe & PG_FRAME);
 			origpte = *pde;
-			if ((origpte & PG_V) == 0)
+			if ((origpte & PG_V) == 0) {
+				mp = PHYS_TO_VM_PAGE(*pdpe & PG_FRAME);
 				mp->ref_count++;
+			}
 		}
 		KASSERT((origpte & PG_V) == 0 || ((origpte & PG_PS) != 0 &&
 		    (origpte & PG_FRAME) == (pten & PG_FRAME)),


More information about the svn-src-all mailing list