Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 31 Aug 2021 19:09:41 GMT
From:      Mark Johnston <markj@FreeBSD.org>
To:        src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org
Subject:   git: 90303162fbc5 - stable/13 - arm64: Use page_to_pvh() when the vm_page_t is known
Message-ID:  <202108311909.17VJ9fjp074096@gitrepo.freebsd.org>

next in thread | raw e-mail | index | archive | help
The branch stable/13 has been updated by markj:

URL: https://cgit.FreeBSD.org/src/commit/?id=90303162fbc59f89089b96b7d8b04460edc5ba97

commit 90303162fbc59f89089b96b7d8b04460edc5ba97
Author:     Alan Cox <alc@FreeBSD.org>
AuthorDate: 2021-06-21 07:45:21 +0000
Commit:     Mark Johnston <markj@FreeBSD.org>
CommitDate: 2021-08-31 19:09:22 +0000

    arm64: Use page_to_pvh() when the vm_page_t is known
    
    When support for a sparse pv_table was added, the implementation of
    pa_to_pvh() changed from a simple constant-time calculation to iterating
    over the array vm_phys_segs[].  To mitigate this issue, an alternative
    function, page_to_pvh(), was introduced that still runs in constant time
    but requires the vm_page_t to be known.  However, three cases where the
    vm_page_t is known were not converted to page_to_pvh().  This change
    converts those three cases.
    
    Reviewed by:    kib, markj
    
    (cherry picked from commit 6f6a166eaf5e59dedb761ea6152417433a841e3b)
---
 sys/arm64/arm64/pmap.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/sys/arm64/arm64/pmap.c b/sys/arm64/arm64/pmap.c
index 343a3d69ddee..8670056e81f5 100644
--- a/sys/arm64/arm64/pmap.c
+++ b/sys/arm64/arm64/pmap.c
@@ -3495,7 +3495,7 @@ pmap_pv_promote_l2(pmap_t pmap, vm_offset_t va, vm_paddr_t pa,
 	va = va & ~L2_OFFSET;
 	pv = pmap_pvh_remove(&m->md, pmap, va);
 	KASSERT(pv != NULL, ("pmap_pv_promote_l2: pv not found"));
-	pvh = pa_to_pvh(pa);
+	pvh = page_to_pvh(m);
 	TAILQ_INSERT_TAIL(&pvh->pv_list, pv, pv_next);
 	pvh->pv_gen++;
 	/* Free the remaining NPTEPG - 1 pv entries. */
@@ -4098,7 +4098,7 @@ havel3:
 			if ((om->a.flags & PGA_WRITEABLE) != 0 &&
 			    TAILQ_EMPTY(&om->md.pv_list) &&
 			    ((om->flags & PG_FICTITIOUS) != 0 ||
-			    TAILQ_EMPTY(&pa_to_pvh(opa)->pv_list)))
+			    TAILQ_EMPTY(&page_to_pvh(om)->pv_list)))
 				vm_page_aflag_clear(om, PGA_WRITEABLE);
 		} else {
 			KASSERT((orig_l3 & ATTR_AF) != 0,
@@ -5209,7 +5209,7 @@ pmap_remove_pages(pmap_t pmap)
 				case 1:
 					pmap_resident_count_dec(pmap,
 					    L2_SIZE / PAGE_SIZE);
-					pvh = pa_to_pvh(tpte & ~ATTR_MASK);
+					pvh = page_to_pvh(m);
 					TAILQ_REMOVE(&pvh->pv_list, pv,pv_next);
 					pvh->pv_gen++;
 					if (TAILQ_EMPTY(&pvh->pv_list)) {



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