The branch main has been updated by alc:

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

commit b7536f9593a30b8253546214f53c9ef063c656a9
Author:     Alan Cox <a...@freebsd.org>
AuthorDate: 2025-06-09 06:34:13 +0000
Commit:     Alan Cox <a...@freebsd.org>
CommitDate: 2025-06-13 17:31:53 +0000

    arm64 pmap: Simplify pmap_demote_l{2,3}c()
    
    Simplify the loop for remaking the mappings in pmap_demote_l{2,3}c().
    Since the mappings are invalid, we needn't use an atomic read-modify-
    write operation to remake the mappings.  The accessed and dirty bits
    won't concurrently change.
---
 sys/arm64/arm64/pmap.c | 12 ++++++------
 1 file changed, 6 insertions(+), 6 deletions(-)

diff --git a/sys/arm64/arm64/pmap.c b/sys/arm64/arm64/pmap.c
index f8e422848e94..3529314b07c7 100644
--- a/sys/arm64/arm64/pmap.c
+++ b/sys/arm64/arm64/pmap.c
@@ -8662,10 +8662,10 @@ pmap_demote_l2c(pmap_t pmap, pt_entry_t *l2p, 
vm_offset_t va)
        /*
         * Remake the mappings, updating the accessed and dirty bits.
         */
+       l2e = (pmap_load(l2c_start) & ~mask) | nbits;
        for (tl2p = l2c_start; tl2p < l2c_end; tl2p++) {
-               l2e = pmap_load(tl2p);
-               while (!atomic_fcmpset_64(tl2p, &l2e, (l2e & ~mask) | nbits))
-                       cpu_spinwait();
+               pmap_store(tl2p, l2e);
+               l2e += L2_SIZE;
        }
        dsb(ishst);
 
@@ -8751,10 +8751,10 @@ pmap_demote_l3c(pmap_t pmap, pt_entry_t *l3p, 
vm_offset_t va)
        /*
         * Remake the mappings, updating the accessed and dirty bits.
         */
+       l3e = (pmap_load(l3c_start) & ~mask) | nbits;
        for (tl3p = l3c_start; tl3p < l3c_end; tl3p++) {
-               l3e = pmap_load(tl3p);
-               while (!atomic_fcmpset_64(tl3p, &l3e, (l3e & ~mask) | nbits))
-                       cpu_spinwait();
+               pmap_store(tl3p, l3e);
+               l3e += L3_SIZE;
        }
        dsb(ishst);
 

Reply via email to