Add vm object locking to pmap_object_init_pt().

This commit is contained in:
alc 2003-06-13 19:27:52 +00:00
parent 698f866771
commit 83fd8b219f

View File

@ -2459,7 +2459,7 @@ pmap_object_init_pt(pmap_t pmap, vm_offset_t addr,
if (pmap == NULL || object == NULL)
return;
VM_OBJECT_LOCK(object);
/*
* This code maps large physical mmap regions into the
* processor address space. Note that some shortcuts
@ -2474,8 +2474,7 @@ pmap_object_init_pt(pmap_t pmap, vm_offset_t addr,
pd_entry_t ptepa;
if (pmap->pm_pdir[ptepindex = (addr >> PDRSHIFT)])
return;
goto unlock_return;
retry:
p = vm_page_lookup(object, pindex);
if (p != NULL) {
@ -2485,14 +2484,14 @@ retry:
} else {
p = vm_page_alloc(object, pindex, VM_ALLOC_NORMAL);
if (p == NULL)
return;
goto unlock_return;
m[0] = p;
if (vm_pager_get_pages(object, m, 1, 0) != VM_PAGER_OK) {
vm_page_lock_queues();
vm_page_free(p);
vm_page_unlock_queues();
return;
goto unlock_return;
}
p = vm_page_lookup(object, pindex);
@ -2503,7 +2502,7 @@ retry:
ptepa = VM_PAGE_TO_PHYS(p);
if (ptepa & (NBPDR - 1)) {
return;
goto unlock_return;
}
p->valid = VM_PAGE_BITS_ALL;
@ -2517,7 +2516,7 @@ retry:
ptepindex += 1;
}
pmap_invalidate_all(kernel_pmap);
return;
goto unlock_return;
}
psize = i386_btop(size);
@ -2525,12 +2524,12 @@ retry:
if ((object->type != OBJT_VNODE) ||
((limit & MAP_PREFAULT_PARTIAL) && (psize > MAX_INIT_PT) &&
(object->resident_page_count > MAX_INIT_PT))) {
return;
goto unlock_return;
}
if (psize + pindex > object->size) {
if (object->size < pindex)
return;
goto unlock_return;
psize = object->size - pindex;
}
@ -2567,14 +2566,17 @@ retry:
vm_page_deactivate(p);
vm_page_busy(p);
vm_page_unlock_queues();
VM_OBJECT_UNLOCK(object);
mpte = pmap_enter_quick(pmap,
addr + i386_ptob(tmpidx), p, mpte);
VM_OBJECT_LOCK(object);
vm_page_lock_queues();
vm_page_wakeup(p);
}
vm_page_unlock_queues();
}
return;
unlock_return:
VM_OBJECT_UNLOCK(object);
}
/*