Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 15 Jul 2014 05:34:28 +0000 (UTC)
From:      Alan Cox <alc@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org
Subject:   svn commit: r268655 - head/sys/arm/arm
Message-ID:  <201407150534.s6F5YSmx040767@svn.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: alc
Date: Tue Jul 15 05:34:27 2014
New Revision: 268655
URL: http://svnweb.freebsd.org/changeset/base/268655

Log:
  Eliminate repeated calculation of next_bucket in pmap_protect() and
  pmap_remove().  Eliminate an unnecessary variable from pmap_remove() and
  pmap_advise().

Modified:
  head/sys/arm/arm/pmap-v6.c

Modified: head/sys/arm/arm/pmap-v6.c
==============================================================================
--- head/sys/arm/arm/pmap-v6.c	Tue Jul 15 05:32:53 2014	(r268654)
+++ head/sys/arm/arm/pmap-v6.c	Tue Jul 15 05:34:27 2014	(r268655)
@@ -2842,8 +2842,8 @@ pmap_protect(pmap_t pmap, vm_offset_t sv
 			 * Are we protecting the entire large page? If not,
 			 * demote the mapping and fall through.
 			 */
-			if (sva + L1_S_SIZE == L2_NEXT_BUCKET(sva) &&
-			    eva >= L2_NEXT_BUCKET(sva)) {
+			if (sva + L1_S_SIZE == next_bucket &&
+			    eva >= next_bucket) {
 				l1pd &= ~(L1_S_PROT_MASK | L1_S_XN);
 				if (!(prot & VM_PROT_EXECUTE))
 					*pl1pd |= L1_S_XN;
@@ -4305,7 +4305,7 @@ pmap_remove(pmap_t pmap, vm_offset_t sva
 {
 	struct l2_bucket *l2b;
 	vm_offset_t next_bucket;
-	pd_entry_t *pl1pd, l1pd;
+	pd_entry_t l1pd;
 	pt_entry_t *ptep;
 	u_int total;
 	u_int mappings, is_exec, is_refd;
@@ -4320,11 +4320,12 @@ pmap_remove(pmap_t pmap, vm_offset_t sva
 	PMAP_LOCK(pmap);
 	total = 0;
 	while (sva < eva) {
+		next_bucket = L2_NEXT_BUCKET(sva);
+
 		/*
 		 * Check for large page.
 		 */
-		pl1pd = &pmap->pm_l1->l1_kva[L1_IDX(sva)];
-		l1pd = *pl1pd;
+		l1pd = pmap->pm_l1->l1_kva[L1_IDX(sva)];
 		if ((l1pd & L1_TYPE_MASK) == L1_S_PROTO) {
 			KASSERT((l1pd & L1_S_DOM_MASK) !=
 			    L1_S_DOM(PMAP_DOMAIN_KERNEL), ("pmap_remove: "
@@ -4333,21 +4334,20 @@ pmap_remove(pmap_t pmap, vm_offset_t sva
 			 * Are we removing the entire large page?  If not,
 			 * demote the mapping and fall through.
 			 */
-			if (sva + L1_S_SIZE == L2_NEXT_BUCKET(sva) &&
-			    eva >= L2_NEXT_BUCKET(sva)) {
+			if (sva + L1_S_SIZE == next_bucket &&
+			    eva >= next_bucket) {
 				pmap_remove_section(pmap, sva);
-				sva = L2_NEXT_BUCKET(sva);
+				sva = next_bucket;
 				continue;
 			} else if (!pmap_demote_section(pmap, sva)) {
 				/* The large page mapping was destroyed. */
-				sva = L2_NEXT_BUCKET(sva);
+				sva = next_bucket;
 				continue;
 			}
 		}
 		/*
 		 * Do one L2 bucket's worth at a time.
 		 */
-		next_bucket = L2_NEXT_BUCKET(sva);
 		if (next_bucket > eva)
 			next_bucket = eva;
 
@@ -4846,7 +4846,7 @@ pmap_advise(pmap_t pmap, vm_offset_t sva
 {
 	struct l2_bucket *l2b;
 	struct pv_entry *pve;
-	pd_entry_t *pl1pd, l1pd;
+	pd_entry_t l1pd;
 	pt_entry_t *ptep, opte, pte;
 	vm_offset_t next_bucket;
 	vm_page_t m;
@@ -4859,8 +4859,7 @@ pmap_advise(pmap_t pmap, vm_offset_t sva
 		next_bucket = L2_NEXT_BUCKET(sva);
 		if (next_bucket < sva)
 			next_bucket = eva;
-		pl1pd = &pmap->pm_l1->l1_kva[L1_IDX(sva)];
-		l1pd = *pl1pd;
+		l1pd = pmap->pm_l1->l1_kva[L1_IDX(sva)];
 		if ((l1pd & L1_TYPE_MASK) == L1_S_PROTO) {
 			if (pmap == pmap_kernel())
 				continue;



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