From e4cec2839810d2bb562e013747e4036063d21f22 Mon Sep 17 00:00:00 2001 From: Alan Cox Date: Mon, 17 Jul 2006 03:10:17 +0000 Subject: [PATCH] Now that free_pv_entry() accesses the pmap, call free_pv_entry() in pmap_remove_all() before rather than after the pmap is unlocked. At present, the page queues lock provides sufficient sychronization. In the future, the page queues lock may not always be held when free_pv_entry() is called. --- sys/amd64/amd64/pmap.c | 3 ++- sys/i386/i386/pmap.c | 3 ++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/sys/amd64/amd64/pmap.c b/sys/amd64/amd64/pmap.c index c5368dba6fb..ed96ba7f363 100644 --- a/sys/amd64/amd64/pmap.c +++ b/sys/amd64/amd64/pmap.c @@ -1627,6 +1627,7 @@ free_pv_entry(pmap_t pmap, pv_entry_t pv) int idx, field, bit; mtx_assert(&vm_page_queue_mtx, MA_OWNED); + PMAP_LOCK_ASSERT(pmap, MA_OWNED); PV_STAT(pv_entry_frees++); PV_STAT(pv_entry_spare++); pv_entry_count--; @@ -2015,8 +2016,8 @@ pmap_remove_all(vm_page_t m) TAILQ_REMOVE(&m->md.pv_list, pv, pv_list); m->md.pv_list_count--; pmap_unuse_pt(pmap, pv->pv_va, ptepde); - PMAP_UNLOCK(pmap); free_pv_entry(pmap, pv); + PMAP_UNLOCK(pmap); } vm_page_flag_clear(m, PG_WRITEABLE); } diff --git a/sys/i386/i386/pmap.c b/sys/i386/i386/pmap.c index e28069907fa..24ae05919f1 100644 --- a/sys/i386/i386/pmap.c +++ b/sys/i386/i386/pmap.c @@ -1702,6 +1702,7 @@ free_pv_entry(pmap_t pmap, pv_entry_t pv) int idx, field, bit; mtx_assert(&vm_page_queue_mtx, MA_OWNED); + PMAP_LOCK_ASSERT(pmap, MA_OWNED); PV_STAT(pv_entry_frees++); PV_STAT(pv_entry_spare++); pv_entry_count--; @@ -2097,8 +2098,8 @@ pmap_remove_all(vm_page_t m) TAILQ_REMOVE(&m->md.pv_list, pv, pv_list); m->md.pv_list_count--; pmap_unuse_pt(pmap, pv->pv_va); - PMAP_UNLOCK(pmap); free_pv_entry(pmap, pv); + PMAP_UNLOCK(pmap); } vm_page_flag_clear(m, PG_WRITEABLE); sched_unpin();