From dd30d349af220ce4f07d30548190b0ee7b8e4106 Mon Sep 17 00:00:00 2001 From: alc Date: Mon, 2 Dec 2002 04:54:21 +0000 Subject: Hold the page queues lock when calling pmap_unwire_pte_hold() or pmap_remove_pte(). Use vm_page_sleep_if_busy() in _pmap_unwire_pte_hold() so that the page queues lock is released when sleeping. Approved by: re (blanket) --- sys/amd64/amd64/pmap.c | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) (limited to 'sys/amd64') diff --git a/sys/amd64/amd64/pmap.c b/sys/amd64/amd64/pmap.c index 5da015a..c842eff 100644 --- a/sys/amd64/amd64/pmap.c +++ b/sys/amd64/amd64/pmap.c @@ -1149,8 +1149,8 @@ static int _pmap_unwire_pte_hold(pmap_t pmap, vm_page_t m) { - while (vm_page_sleep_busy(m, FALSE, "pmuwpt")) - ; + while (vm_page_sleep_if_busy(m, FALSE, "pmuwpt")) + vm_page_lock_queues(); if (m->hold_count == 0) { vm_offset_t pteva; @@ -2133,7 +2133,9 @@ pmap_enter(pmap_t pmap, vm_offset_t va, vm_page_t m, vm_prot_t prot, */ if (opa) { int err; + vm_page_lock_queues(); err = pmap_remove_pte(pmap, pte, va); + vm_page_unlock_queues(); if (err) panic("pmap_enter: pte vanished, va: 0x%x", va); } @@ -2252,8 +2254,11 @@ retry: */ pte = vtopte(va); if (*pte) { - if (mpte) + if (mpte != NULL) { + vm_page_lock_queues(); pmap_unwire_pte_hold(pmap, mpte); + vm_page_unlock_queues(); + } return 0; } @@ -2667,7 +2672,9 @@ pmap_copy(pmap_t dst_pmap, pmap_t src_pmap, vm_offset_t dst_addr, vm_size_t len, pmap_insert_entry(dst_pmap, addr, dstmpte, m); } else { + vm_page_lock_queues(); pmap_unwire_pte_hold(dst_pmap, dstmpte); + vm_page_unlock_queues(); } if (dstmpte->hold_count >= srcmpte->hold_count) break; -- cgit v1.1