diff options
author | alc <alc@FreeBSD.org> | 2010-07-02 19:59:18 +0000 |
---|---|---|
committer | alc <alc@FreeBSD.org> | 2010-07-02 19:59:18 +0000 |
commit | 3e4ac0b6ee6ec8f80da577692259abc26fbf1b17 (patch) | |
tree | e72b00811f8b1166ede614937b76e69a1f135bd5 /sys/vm/vm_fault.c | |
parent | 395ada53131ac8579226ebb90984f8f4dda713e2 (diff) | |
download | FreeBSD-src-3e4ac0b6ee6ec8f80da577692259abc26fbf1b17.zip FreeBSD-src-3e4ac0b6ee6ec8f80da577692259abc26fbf1b17.tar.gz |
Use vm_page_prev() instead of vm_page_lookup() in the implementation of
vm_fault()'s automatic delete-behind heuristic.
vm_page_prev() is typically faster.
Diffstat (limited to 'sys/vm/vm_fault.c')
-rw-r--r-- | sys/vm/vm_fault.c | 22 |
1 files changed, 12 insertions, 10 deletions
diff --git a/sys/vm/vm_fault.c b/sys/vm/vm_fault.c index f0a2095..463bd1f 100644 --- a/sys/vm/vm_fault.c +++ b/sys/vm/vm_fault.c @@ -214,7 +214,7 @@ vm_fault(vm_map_t map, vm_offset_t vaddr, vm_prot_t fault_type, boolean_t growstack, wired; int map_generation; vm_object_t next_object; - vm_page_t marray[VM_FAULT_READ]; + vm_page_t marray[VM_FAULT_READ], mt, mt_prev; int hardfault; int faultcount, ahead, behind, alloc_req; struct faultstate fs; @@ -465,26 +465,28 @@ readrest: fs.first_object->type != OBJT_DEVICE && fs.first_object->type != OBJT_PHYS && fs.first_object->type != OBJT_SG) { - vm_pindex_t firstpindex, tmppindex; + vm_pindex_t firstpindex; if (fs.first_pindex < 2 * VM_FAULT_READ) firstpindex = 0; else firstpindex = fs.first_pindex - 2 * VM_FAULT_READ; + mt = fs.first_object != fs.object ? + fs.first_m : fs.m; + KASSERT(mt != NULL, ("vm_fault: missing mt")); + KASSERT((mt->oflags & VPO_BUSY) != 0, + ("vm_fault: mt %p not busy", mt)); + mt_prev = vm_page_prev(mt); /* * note: partially valid pages cannot be * included in the lookahead - NFS piecemeal * writes will barf on it badly. */ - for (tmppindex = fs.first_pindex - 1; - tmppindex >= firstpindex; - --tmppindex) { - vm_page_t mt; - - mt = vm_page_lookup(fs.first_object, tmppindex); - if (mt == NULL || (mt->valid != VM_PAGE_BITS_ALL)) - break; + while ((mt = mt_prev) != NULL && + mt->pindex >= firstpindex && + mt->valid == VM_PAGE_BITS_ALL) { + mt_prev = vm_page_prev(mt); if (mt->busy || (mt->oflags & VPO_BUSY)) continue; |