diff options
author | alc <alc@FreeBSD.org> | 2003-10-04 22:47:20 +0000 |
---|---|---|
committer | alc <alc@FreeBSD.org> | 2003-10-04 22:47:20 +0000 |
commit | 74f19ddd0e60157ed1517ea26258f4b89b688bea (patch) | |
tree | bcc62a1f6dd20782861d575ffd668d3b1ffc2c49 /sys/kern/kern_exec.c | |
parent | 1cffeebc9c7faa93e9b4c832c7416598e61b0068 (diff) | |
download | FreeBSD-src-74f19ddd0e60157ed1517ea26258f4b89b688bea.zip FreeBSD-src-74f19ddd0e60157ed1517ea26258f4b89b688bea.tar.gz |
Eliminate some unnecessary uses of the vm page queues lock around the
vm page's valid field. This field is being synchronized using the
containing vm object's lock.
Diffstat (limited to 'sys/kern/kern_exec.c')
-rw-r--r-- | sys/kern/kern_exec.c | 15 |
1 files changed, 6 insertions, 9 deletions
diff --git a/sys/kern/kern_exec.c b/sys/kern/kern_exec.c index e887d05..fde4ee4 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]; |