o Lock page queue accesses by vm_page_deactivate().

This commit is contained in:
Alan Cox 2002-08-02 04:14:19 +00:00
parent 91bb74a88c
commit 64a1b85efa
2 changed files with 30 additions and 6 deletions

View File

@ -2405,17 +2405,21 @@ pmap_object_init_pt(pmap_t pmap, vm_offset_t addr,
cnt.v_free_count < cnt.v_free_reserved) { cnt.v_free_count < cnt.v_free_reserved) {
break; break;
} }
vm_page_lock_queues();
if (((p->valid & VM_PAGE_BITS_ALL) == VM_PAGE_BITS_ALL) && if (((p->valid & VM_PAGE_BITS_ALL) == VM_PAGE_BITS_ALL) &&
(p->busy == 0) && (p->busy == 0) &&
(p->flags & (PG_BUSY | PG_FICTITIOUS)) == 0) { (p->flags & (PG_BUSY | PG_FICTITIOUS)) == 0) {
if ((p->queue - p->pc) == PQ_CACHE) if ((p->queue - p->pc) == PQ_CACHE)
vm_page_deactivate(p); vm_page_deactivate(p);
vm_page_busy(p); vm_page_busy(p);
vm_page_unlock_queues();
mpte = pmap_enter_quick(pmap, mpte = pmap_enter_quick(pmap,
addr + i386_ptob(tmpidx), p, mpte); addr + i386_ptob(tmpidx), p, mpte);
vm_page_lock_queues();
vm_page_flag_set(p, PG_MAPPED); vm_page_flag_set(p, PG_MAPPED);
vm_page_wakeup(p); vm_page_wakeup(p);
} }
vm_page_unlock_queues();
objpgs -= 1; objpgs -= 1;
} }
} else { } else {
@ -2432,18 +2436,23 @@ pmap_object_init_pt(pmap_t pmap, vm_offset_t addr,
break; break;
} }
p = vm_page_lookup(object, tmpidx + pindex); p = vm_page_lookup(object, tmpidx + pindex);
if (p && if (p == NULL)
((p->valid & VM_PAGE_BITS_ALL) == VM_PAGE_BITS_ALL) && continue;
vm_page_lock_queues();
if ((p->valid & VM_PAGE_BITS_ALL) == VM_PAGE_BITS_ALL &&
(p->busy == 0) && (p->busy == 0) &&
(p->flags & (PG_BUSY | PG_FICTITIOUS)) == 0) { (p->flags & (PG_BUSY | PG_FICTITIOUS)) == 0) {
if ((p->queue - p->pc) == PQ_CACHE) if ((p->queue - p->pc) == PQ_CACHE)
vm_page_deactivate(p); vm_page_deactivate(p);
vm_page_busy(p); vm_page_busy(p);
vm_page_unlock_queues();
mpte = pmap_enter_quick(pmap, mpte = pmap_enter_quick(pmap,
addr + i386_ptob(tmpidx), p, mpte); addr + i386_ptob(tmpidx), p, mpte);
vm_page_lock_queues();
vm_page_flag_set(p, PG_MAPPED); vm_page_flag_set(p, PG_MAPPED);
vm_page_wakeup(p); vm_page_wakeup(p);
} }
vm_page_unlock_queues();
} }
} }
return; return;
@ -2526,7 +2535,7 @@ pmap_prefault(pmap, addra, entry)
*/ */
if (m == NULL) if (m == NULL)
break; break;
vm_page_lock_queues();
if (((m->valid & VM_PAGE_BITS_ALL) == VM_PAGE_BITS_ALL) && if (((m->valid & VM_PAGE_BITS_ALL) == VM_PAGE_BITS_ALL) &&
(m->busy == 0) && (m->busy == 0) &&
(m->flags & (PG_BUSY | PG_FICTITIOUS)) == 0) { (m->flags & (PG_BUSY | PG_FICTITIOUS)) == 0) {
@ -2535,10 +2544,13 @@ pmap_prefault(pmap, addra, entry)
vm_page_deactivate(m); vm_page_deactivate(m);
} }
vm_page_busy(m); vm_page_busy(m);
vm_page_unlock_queues();
mpte = pmap_enter_quick(pmap, addr, m, mpte); mpte = pmap_enter_quick(pmap, addr, m, mpte);
vm_page_lock_queues();
vm_page_flag_set(m, PG_MAPPED); vm_page_flag_set(m, PG_MAPPED);
vm_page_wakeup(m); vm_page_wakeup(m);
} }
vm_page_unlock_queues();
} }
} }

View File

@ -2405,17 +2405,21 @@ pmap_object_init_pt(pmap_t pmap, vm_offset_t addr,
cnt.v_free_count < cnt.v_free_reserved) { cnt.v_free_count < cnt.v_free_reserved) {
break; break;
} }
vm_page_lock_queues();
if (((p->valid & VM_PAGE_BITS_ALL) == VM_PAGE_BITS_ALL) && if (((p->valid & VM_PAGE_BITS_ALL) == VM_PAGE_BITS_ALL) &&
(p->busy == 0) && (p->busy == 0) &&
(p->flags & (PG_BUSY | PG_FICTITIOUS)) == 0) { (p->flags & (PG_BUSY | PG_FICTITIOUS)) == 0) {
if ((p->queue - p->pc) == PQ_CACHE) if ((p->queue - p->pc) == PQ_CACHE)
vm_page_deactivate(p); vm_page_deactivate(p);
vm_page_busy(p); vm_page_busy(p);
vm_page_unlock_queues();
mpte = pmap_enter_quick(pmap, mpte = pmap_enter_quick(pmap,
addr + i386_ptob(tmpidx), p, mpte); addr + i386_ptob(tmpidx), p, mpte);
vm_page_lock_queues();
vm_page_flag_set(p, PG_MAPPED); vm_page_flag_set(p, PG_MAPPED);
vm_page_wakeup(p); vm_page_wakeup(p);
} }
vm_page_unlock_queues();
objpgs -= 1; objpgs -= 1;
} }
} else { } else {
@ -2432,18 +2436,23 @@ pmap_object_init_pt(pmap_t pmap, vm_offset_t addr,
break; break;
} }
p = vm_page_lookup(object, tmpidx + pindex); p = vm_page_lookup(object, tmpidx + pindex);
if (p && if (p == NULL)
((p->valid & VM_PAGE_BITS_ALL) == VM_PAGE_BITS_ALL) && continue;
vm_page_lock_queues();
if ((p->valid & VM_PAGE_BITS_ALL) == VM_PAGE_BITS_ALL &&
(p->busy == 0) && (p->busy == 0) &&
(p->flags & (PG_BUSY | PG_FICTITIOUS)) == 0) { (p->flags & (PG_BUSY | PG_FICTITIOUS)) == 0) {
if ((p->queue - p->pc) == PQ_CACHE) if ((p->queue - p->pc) == PQ_CACHE)
vm_page_deactivate(p); vm_page_deactivate(p);
vm_page_busy(p); vm_page_busy(p);
vm_page_unlock_queues();
mpte = pmap_enter_quick(pmap, mpte = pmap_enter_quick(pmap,
addr + i386_ptob(tmpidx), p, mpte); addr + i386_ptob(tmpidx), p, mpte);
vm_page_lock_queues();
vm_page_flag_set(p, PG_MAPPED); vm_page_flag_set(p, PG_MAPPED);
vm_page_wakeup(p); vm_page_wakeup(p);
} }
vm_page_unlock_queues();
} }
} }
return; return;
@ -2526,7 +2535,7 @@ pmap_prefault(pmap, addra, entry)
*/ */
if (m == NULL) if (m == NULL)
break; break;
vm_page_lock_queues();
if (((m->valid & VM_PAGE_BITS_ALL) == VM_PAGE_BITS_ALL) && if (((m->valid & VM_PAGE_BITS_ALL) == VM_PAGE_BITS_ALL) &&
(m->busy == 0) && (m->busy == 0) &&
(m->flags & (PG_BUSY | PG_FICTITIOUS)) == 0) { (m->flags & (PG_BUSY | PG_FICTITIOUS)) == 0) {
@ -2535,10 +2544,13 @@ pmap_prefault(pmap, addra, entry)
vm_page_deactivate(m); vm_page_deactivate(m);
} }
vm_page_busy(m); vm_page_busy(m);
vm_page_unlock_queues();
mpte = pmap_enter_quick(pmap, addr, m, mpte); mpte = pmap_enter_quick(pmap, addr, m, mpte);
vm_page_lock_queues();
vm_page_flag_set(m, PG_MAPPED); vm_page_flag_set(m, PG_MAPPED);
vm_page_wakeup(m); vm_page_wakeup(m);
} }
vm_page_unlock_queues();
} }
} }