kernel - Acquire vm_token in pmap_remove_all() (3)
authorMatthew Dillon <dillon@apollo.backplane.com>
Fri, 5 Oct 2012 05:15:04 +0000 (22:15 -0700)
committerMatthew Dillon <dillon@apollo.backplane.com>
Fri, 5 Oct 2012 05:15:04 +0000 (22:15 -0700)
* Correct bug in last commit, resident_count adjustment has to be
  moved past the revalidation.

sys/platform/pc32/i386/pmap.c

index 2b91cf0..fcd60c3 100644 (file)
@@ -2062,7 +2062,6 @@ pmap_remove_all(vm_page_t m)
        while ((pv = TAILQ_FIRST(&m->md.pv_list)) != NULL) {
                pmap = pv->pv_pmap;
                KKASSERT(pmap->pm_stats.resident_count > 0);
-               --pmap->pm_stats.resident_count;
                pmap_hold(pmap);
                vm_object_hold(pmap->pm_pteobj);
 
@@ -2074,6 +2073,7 @@ pmap_remove_all(vm_page_t m)
                        continue;
                }
 
+               --pmap->pm_stats.resident_count;
                pte = pmap_pte_quick(pmap, pv->pv_va);
                pmap_inval_interlock(&info, pmap, pv->pv_va);
                tpte = loadandclear(pte);