Skip site navigation (1)Skip section navigation (2)
Date:      Sat, 15 Feb 2014 13:22:37 +0000 (UTC)
From:      Zbigniew Bodek <zbb@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org
Subject:   svn commit: r261920 - head/sys/arm/arm
Message-ID:  <201402151322.s1FDMb1X020908@svn.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: zbb
Date: Sat Feb 15 13:22:37 2014
New Revision: 261920
URL: http://svnweb.freebsd.org/changeset/base/261920

Log:
  Avoid redundant superpage promotion attempts on ARM
  
  Because pmap_enter_locked() is called from few different functions
  some redundancy in superpage promotion attempts can be observed.
  Hence, avoid promotion in pmap_enter_object() (if the object can
  be mapped by superpage it will be handled by pmap_enter_object()
  itself) and also do not waste time in pmap_enter_quick().
  From now on the promotion will be performed only in pmap_enter().

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

Modified: head/sys/arm/arm/pmap-v6.c
==============================================================================
--- head/sys/arm/arm/pmap-v6.c	Sat Feb 15 13:20:17 2014	(r261919)
+++ head/sys/arm/arm/pmap-v6.c	Sat Feb 15 13:22:37 2014	(r261920)
@@ -2924,10 +2924,21 @@ void
 pmap_enter(pmap_t pmap, vm_offset_t va, vm_prot_t access, vm_page_t m,
     vm_prot_t prot, boolean_t wired)
 {
+	struct l2_bucket *l2b;
 
 	rw_wlock(&pvh_global_lock);
 	PMAP_LOCK(pmap);
 	pmap_enter_locked(pmap, va, access, m, prot, wired, M_WAITOK);
+	/*
+	 * If both the l2b_occupancy and the reservation are fully
+	 * populated, then attempt promotion.
+	 */
+	l2b = pmap_get_l2_bucket(pmap, va);
+	if ((l2b != NULL) && (l2b->l2b_occupancy == L2_PTE_NUM_TOTAL) &&
+	    sp_enabled && (m->flags & PG_FICTITIOUS) == 0 &&
+	    vm_reserv_level_iffullpop(m) == 0)
+		pmap_promote_section(pmap, va);
+
 	PMAP_UNLOCK(pmap);
 	rw_wunlock(&pvh_global_lock);
 }
@@ -3153,14 +3164,6 @@ validate:
 
 	if ((pmap != pmap_kernel()) && (pmap == &curproc->p_vmspace->vm_pmap))
 		cpu_icache_sync_range(va, PAGE_SIZE);
-	/*
-	 * If both the l2b_occupancy and the reservation are fully
-	 * populated, then attempt promotion.
-	 */
-	if ((l2b->l2b_occupancy == L2_PTE_NUM_TOTAL) &&
-	    sp_enabled && (m->flags & PG_FICTITIOUS) == 0 &&
-	    vm_reserv_level_iffullpop(m) == 0)
-		pmap_promote_section(pmap, va);
 }
 
 /*



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