Skip site navigation (1)Skip section navigation (2)
Date:      Sun, 19 Feb 2017 03:33:20 +0000 (UTC)
From:      Konstantin Belousov <kib@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org
Subject:   svn commit: r313933 - head/sys/amd64/amd64
Message-ID:  <201702190333.v1J3XKQB067946@repo.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: kib
Date: Sun Feb 19 03:33:20 2017
New Revision: 313933
URL: https://svnweb.freebsd.org/changeset/base/313933

Log:
  Microoptimize amd64/pmap.c pmap_protect_pde().
  
  For the loop that dirties vm_pages in case superpage was written to,
  check the complete condition before the loop.
  
  Reviewed by:	alc
  Sponsored by:	The FreeBSD Foundation
  MFC after:	1 week

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

Modified: head/sys/amd64/amd64/pmap.c
==============================================================================
--- head/sys/amd64/amd64/pmap.c	Sun Feb 19 03:17:11 2017	(r313932)
+++ head/sys/amd64/amd64/pmap.c	Sun Feb 19 03:33:20 2017	(r313933)
@@ -3998,12 +3998,12 @@ pmap_protect_pde(pmap_t pmap, pd_entry_t
 	anychanged = FALSE;
 retry:
 	oldpde = newpde = *pde;
-	if (oldpde & PG_MANAGED) {
+	if ((oldpde & (PG_MANAGED | PG_M | PG_RW)) ==
+	    (PG_MANAGED | PG_M | PG_RW)) {
 		eva = sva + NBPDR;
 		for (va = sva, m = PHYS_TO_VM_PAGE(oldpde & PG_PS_FRAME);
 		    va < eva; va += PAGE_SIZE, m++)
-			if ((oldpde & (PG_M | PG_RW)) == (PG_M | PG_RW))
-				vm_page_dirty(m);
+			vm_page_dirty(m);
 	}
 	if ((prot & VM_PROT_WRITE) == 0)
 		newpde &= ~(PG_RW | PG_M);



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201702190333.v1J3XKQB067946>