Author: markj
Date: Tue Jun  4 17:25:45 2019
New Revision: 348639
URL: https://svnweb.freebsd.org/changeset/base/348639

Log:
  MFC r342765:
  Fix dirty bit handling in pmap_remove_write().

Modified:
  stable/12/sys/riscv/riscv/pmap.c
Directory Properties:
  stable/12/   (props changed)

Modified: stable/12/sys/riscv/riscv/pmap.c
==============================================================================
--- stable/12/sys/riscv/riscv/pmap.c    Tue Jun  4 17:25:22 2019        
(r348638)
+++ stable/12/sys/riscv/riscv/pmap.c    Tue Jun  4 17:25:45 2019        
(r348639)
@@ -2938,15 +2938,13 @@ retry_pv_loop:
                        }
                }
                l3 = pmap_l3(pmap, pv->pv_va);
-retry:
                oldl3 = pmap_load(l3);
-
+retry:
                if ((oldl3 & PTE_W) != 0) {
-                       newl3 = oldl3 & ~PTE_W;
-                       if (!atomic_cmpset_long(l3, oldl3, newl3))
+                       newl3 = oldl3 & ~(PTE_D | PTE_W);
+                       if (!atomic_fcmpset_long(l3, &oldl3, newl3))
                                goto retry;
-                       /* TODO: check for PTE_D? */
-                       if ((oldl3 & PTE_A) != 0)
+                       if ((oldl3 & PTE_D) != 0)
                                vm_page_dirty(m);
                        pmap_invalidate_page(pmap, pv->pv_va);
                }
_______________________________________________
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"

Reply via email to