git: f62a4c089c38 - stable/13 - arm64: replace pa_to_pvh() with page_to_pvh() in pmap_remove_l2()
Mark Johnston
markj at FreeBSD.org
Tue Aug 31 19:09:43 UTC 2021
The branch stable/13 has been updated by markj:
URL: https://cgit.FreeBSD.org/src/commit/?id=f62a4c089c387504fd64fe835381810afdcfc45e
commit f62a4c089c387504fd64fe835381810afdcfc45e
Author: Alan Cox <alc at FreeBSD.org>
AuthorDate: 2021-06-23 19:14:31 +0000
Commit: Mark Johnston <markj at FreeBSD.org>
CommitDate: 2021-08-31 19:09:23 +0000
arm64: replace pa_to_pvh() with page_to_pvh() in pmap_remove_l2()
Revise pmap_remove_l2() to use the constant-time function page_to_pvh()
instead of the linear-time function pa_to_pvh().
Reviewed by: kib, markj
(cherry picked from commit 0c188c06c627b5de30eeeeb7cde00d071a80ecfa)
---
sys/arm64/arm64/pmap.c | 18 ++++++++----------
1 file changed, 8 insertions(+), 10 deletions(-)
diff --git a/sys/arm64/arm64/pmap.c b/sys/arm64/arm64/pmap.c
index 0df53a60bcea..4af87b24a92d 100644
--- a/sys/arm64/arm64/pmap.c
+++ b/sys/arm64/arm64/pmap.c
@@ -2851,8 +2851,7 @@ pmap_remove_l2(pmap_t pmap, pt_entry_t *l2, vm_offset_t sva,
{
struct md_page *pvh;
pt_entry_t old_l2;
- vm_offset_t eva, va;
- vm_page_t m, ml3;
+ vm_page_t m, ml3, mt;
PMAP_LOCK_ASSERT(pmap, MA_OWNED);
KASSERT((sva & L2_OFFSET) == 0, ("pmap_remove_l2: sva is not aligned"));
@@ -2870,19 +2869,18 @@ pmap_remove_l2(pmap_t pmap, pt_entry_t *l2, vm_offset_t sva,
pmap->pm_stats.wired_count -= L2_SIZE / PAGE_SIZE;
pmap_resident_count_dec(pmap, L2_SIZE / PAGE_SIZE);
if (old_l2 & ATTR_SW_MANAGED) {
+ m = PHYS_TO_VM_PAGE(old_l2 & ~ATTR_MASK);
+ pvh = page_to_pvh(m);
CHANGE_PV_LIST_LOCK_TO_PHYS(lockp, old_l2 & ~ATTR_MASK);
- pvh = pa_to_pvh(old_l2 & ~ATTR_MASK);
pmap_pvh_free(pvh, pmap, sva);
- eva = sva + L2_SIZE;
- for (va = sva, m = PHYS_TO_VM_PAGE(old_l2 & ~ATTR_MASK);
- va < eva; va += PAGE_SIZE, m++) {
+ for (mt = m; mt < &m[L2_SIZE / PAGE_SIZE]; mt++) {
if (pmap_pte_dirty(pmap, old_l2))
- vm_page_dirty(m);
+ vm_page_dirty(mt);
if (old_l2 & ATTR_AF)
- vm_page_aflag_set(m, PGA_REFERENCED);
- if (TAILQ_EMPTY(&m->md.pv_list) &&
+ vm_page_aflag_set(mt, PGA_REFERENCED);
+ if (TAILQ_EMPTY(&mt->md.pv_list) &&
TAILQ_EMPTY(&pvh->pv_list))
- vm_page_aflag_clear(m, PGA_WRITEABLE);
+ vm_page_aflag_clear(mt, PGA_WRITEABLE);
}
}
if (pmap == kernel_pmap) {
More information about the dev-commits-src-branches
mailing list