The branch main has been updated by markj:

URL: 
https://cgit.FreeBSD.org/src/commit/?id=0b8372b707a50c2deeaf66d4c55fec51007cec44

commit 0b8372b707a50c2deeaf66d4c55fec51007cec44
Author:     Mark Johnston <ma...@freebsd.org>
AuthorDate: 2023-11-02 18:34:07 +0000
Commit:     Mark Johnston <ma...@freebsd.org>
CommitDate: 2023-11-02 18:34:07 +0000

    riscv: Port improvements from arm64/amd64 pmaps, part 3
    
    - Let pmap_enter_quick_locked() trigger superpage promotions.
    
    Reviewed by:    kib
    MFC after:      1 month
    Differential Revision:  https://reviews.freebsd.org/D42290
---
 sys/riscv/riscv/pmap.c | 21 +++++++++++++++++++++
 1 file changed, 21 insertions(+)

diff --git a/sys/riscv/riscv/pmap.c b/sys/riscv/riscv/pmap.c
index 9b2866d7dd4d..ebb0f069b4ab 100644
--- a/sys/riscv/riscv/pmap.c
+++ b/sys/riscv/riscv/pmap.c
@@ -3405,6 +3405,7 @@ pmap_enter_quick_locked(pmap_t pmap, vm_offset_t va, 
vm_page_t m,
            ("pmap_enter_quick_locked: managed mapping within the clean 
submap"));
        rw_assert(&pvh_global_lock, RA_LOCKED);
        PMAP_LOCK_ASSERT(pmap, MA_OWNED);
+       l2 = NULL;
 
        CTR2(KTR_PMAP, "pmap_enter_quick_locked: %p %lx", pmap, va);
        /*
@@ -3503,6 +3504,26 @@ pmap_enter_quick_locked(pmap_t pmap, vm_offset_t va, 
vm_page_t m,
 
        pmap_store(l3, newl3);
 
+#if VM_NRESERVLEVEL > 0
+       /*
+        * If both the PTP and the reservation are fully populated, then attempt
+        * promotion.
+        */
+       if ((mpte == NULL || mpte->ref_count == Ln_ENTRIES) &&
+           (m->flags & PG_FICTITIOUS) == 0 &&
+           vm_reserv_level_iffullpop(m) == 0) {
+               if (l2 == NULL)
+                       l2 = pmap_l2(pmap, va);
+
+               /*
+                * If promotion succeeds, then the next call to this function
+                * should not be given the unmapped PTP as a hint.
+                */
+               if (pmap_promote_l2(pmap, l2, va, mpte, lockp))
+                       mpte = NULL;
+       }
+#endif
+
        pmap_invalidate_page(pmap, va);
        return (mpte);
 }

Reply via email to