diff options
author | alc <alc@FreeBSD.org> | 2003-06-13 19:27:52 +0000 |
---|---|---|
committer | alc <alc@FreeBSD.org> | 2003-06-13 19:27:52 +0000 |
commit | 83fd8b219f97b55ffe01f54ad4dc3812e2f659f6 (patch) | |
tree | 73543d3572f1c22aca317bcbd3d6ae1a84eb3a92 | |
parent | 698f866771c54c49fd9d78bc2d352231f525172c (diff) | |
download | FreeBSD-src-83fd8b219f97b55ffe01f54ad4dc3812e2f659f6.zip FreeBSD-src-83fd8b219f97b55ffe01f54ad4dc3812e2f659f6.tar.gz |
Add vm object locking to pmap_object_init_pt().
-rw-r--r-- | sys/i386/i386/pmap.c | 22 |
1 files changed, 12 insertions, 10 deletions
diff --git a/sys/i386/i386/pmap.c b/sys/i386/i386/pmap.c index e736b68..c913570 100644 --- a/sys/i386/i386/pmap.c +++ b/sys/i386/i386/pmap.c @@ -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); } /* |