summaryrefslogtreecommitdiff
path: root/sys/kern/kern_exec.c
diff options
context:
space:
mode:
authorAlan Cox <alc@FreeBSD.org>2003-10-04 22:47:20 +0000
committerAlan Cox <alc@FreeBSD.org>2003-10-04 22:47:20 +0000
commit6ec2fca50516204b21052ffad9799aa225d0b122 (patch)
treebcc62a1f6dd20782861d575ffd668d3b1ffc2c49 /sys/kern/kern_exec.c
parent272487f5070394f5759f6982c1ac5c3ed33a1cfe (diff)
Notes
Diffstat (limited to 'sys/kern/kern_exec.c')
-rw-r--r--sys/kern/kern_exec.c15
1 files changed, 6 insertions, 9 deletions
diff --git a/sys/kern/kern_exec.c b/sys/kern/kern_exec.c
index e887d052a392..fde4ee487731 100644
--- a/sys/kern/kern_exec.c
+++ b/sys/kern/kern_exec.c
@@ -744,23 +744,19 @@ exec_map_first_page(imgp)
VOP_GETVOBJECT(imgp->vp, &object);
VM_OBJECT_LOCK(object);
ma[0] = vm_page_grab(object, 0, VM_ALLOC_NORMAL | VM_ALLOC_RETRY);
- vm_page_lock_queues();
if ((ma[0]->valid & VM_PAGE_BITS_ALL) != VM_PAGE_BITS_ALL) {
- vm_page_unlock_queues();
initial_pagein = VM_INITIAL_PAGEIN;
if (initial_pagein > object->size)
initial_pagein = object->size;
for (i = 1; i < initial_pagein; i++) {
if ((ma[i] = vm_page_lookup(object, i)) != NULL) {
+ if (ma[i]->valid)
+ break;
vm_page_lock_queues();
if ((ma[i]->flags & PG_BUSY) || ma[i]->busy) {
vm_page_unlock_queues();
break;
}
- if (ma[i]->valid) {
- vm_page_unlock_queues();
- break;
- }
vm_page_busy(ma[i]);
vm_page_unlock_queues();
} else {
@@ -773,22 +769,23 @@ exec_map_first_page(imgp)
initial_pagein = i;
rv = vm_pager_get_pages(object, ma, initial_pagein, 0);
ma[0] = vm_page_lookup(object, 0);
- vm_page_lock_queues();
if ((rv != VM_PAGER_OK) || (ma[0] == NULL) ||
(ma[0]->valid == 0)) {
if (ma[0]) {
+ vm_page_lock_queues();
pmap_remove_all(ma[0]);
vm_page_free(ma[0]);
+ vm_page_unlock_queues();
}
- vm_page_unlock_queues();
VM_OBJECT_UNLOCK(object);
return (EIO);
}
}
- VM_OBJECT_UNLOCK(object);
+ vm_page_lock_queues();
vm_page_wire(ma[0]);
vm_page_wakeup(ma[0]);
vm_page_unlock_queues();
+ VM_OBJECT_UNLOCK(object);
pmap_qenter((vm_offset_t)imgp->image_header, ma, 1);
imgp->firstpage = ma[0];