Author: markj
Date: Wed Oct 23 13:41:26 2019
New Revision: 353922
URL: https://svnweb.freebsd.org/changeset/base/353922

Log:
  MFC r353650:
  Clear PGA_WRITEABLE in moea_pvo_remove().

Modified:
  stable/12/sys/powerpc/aim/mmu_oea.c
Directory Properties:
  stable/12/   (props changed)

Modified: stable/12/sys/powerpc/aim/mmu_oea.c
==============================================================================
--- stable/12/sys/powerpc/aim/mmu_oea.c Wed Oct 23 13:40:39 2019        
(r353921)
+++ stable/12/sys/powerpc/aim/mmu_oea.c Wed Oct 23 13:41:26 2019        
(r353922)
@@ -2120,23 +2120,26 @@ moea_pvo_remove(struct pvo_entry *pvo, int pteidx)
                pvo->pvo_pmap->pm_stats.wired_count--;
 
        /*
+        * Remove this PVO from the PV and pmap lists.
+        */
+       LIST_REMOVE(pvo, pvo_vlink);
+       RB_REMOVE(pvo_tree, &pvo->pvo_pmap->pmap_pvo, pvo);
+
+       /*
         * Save the REF/CHG bits into their cache if the page is managed.
+        * Clear PGA_WRITEABLE if all mappings of the page have been removed.
         */
        if ((pvo->pvo_vaddr & PVO_MANAGED) == PVO_MANAGED) {
-               struct  vm_page *pg;
+               struct vm_page *pg;
 
                pg = PHYS_TO_VM_PAGE(pvo->pvo_pte.pte.pte_lo & PTE_RPGN);
                if (pg != NULL) {
                        moea_attr_save(pg, pvo->pvo_pte.pte.pte_lo &
                            (PTE_REF | PTE_CHG));
+                       if (LIST_EMPTY(&pg->md.mdpg_pvoh))
+                               vm_page_aflag_clear(pg, PGA_WRITEABLE);
                }
        }
-
-       /*
-        * Remove this PVO from the PV and pmap lists.
-        */
-       LIST_REMOVE(pvo, pvo_vlink);
-       RB_REMOVE(pvo_tree, &pvo->pvo_pmap->pmap_pvo, pvo);
 
        /*
         * Remove this from the overflow list and return it to the pool
_______________________________________________
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