diff options
author | alc <alc@FreeBSD.org> | 2006-05-13 20:05:44 +0000 |
---|---|---|
committer | alc <alc@FreeBSD.org> | 2006-05-13 20:05:44 +0000 |
commit | 951cb632930323698ff5947c2bc22612041de59e (patch) | |
tree | d542856defd52c42899173a1f9493935be4fd76b | |
parent | fd3a903ce15fdb4e21a1f30a3400a596fc47ae9d (diff) | |
download | FreeBSD-src-951cb632930323698ff5947c2bc22612041de59e.zip FreeBSD-src-951cb632930323698ff5947c2bc22612041de59e.tar.gz |
Simplify the implementation of vm_fault_additional_pages() based upon the
object's memq being ordered. Specifically, replace repeated calls to
vm_page_lookup() by two simple constant-time operations.
Reviewed by: tegge
-rw-r--r-- | sys/vm/vm_fault.c | 17 |
1 files changed, 5 insertions, 12 deletions
diff --git a/sys/vm/vm_fault.c b/sys/vm/vm_fault.c index 7417fc1..2484af1 100644 --- a/sys/vm/vm_fault.c +++ b/sys/vm/vm_fault.c @@ -1301,14 +1301,9 @@ vm_fault_additional_pages(m, rbehind, rahead, marray, reqpage) startpindex = pindex - rbehind; } - for (tpindex = pindex - 1; tpindex >= startpindex; tpindex -= 1) { - if (vm_page_lookup(object, tpindex)) { - startpindex = tpindex + 1; - break; - } - if (tpindex == 0) - break; - } + if ((rtm = TAILQ_PREV(m, pglist, listq)) != NULL && + rtm->pindex >= startpindex) + startpindex = rtm->pindex + 1; for (i = 0, tpindex = startpindex; tpindex < pindex; i++, tpindex++) { @@ -1342,15 +1337,13 @@ vm_fault_additional_pages(m, rbehind, rahead, marray, reqpage) * scan forward for the read ahead pages */ endpindex = tpindex + rahead; + if ((rtm = TAILQ_NEXT(m, listq)) != NULL && rtm->pindex < endpindex) + endpindex = rtm->pindex; if (endpindex > object->size) endpindex = object->size; for (; tpindex < endpindex; i++, tpindex++) { - if (vm_page_lookup(object, tpindex)) { - break; - } - rtm = vm_page_alloc(object, tpindex, VM_ALLOC_NORMAL); if (rtm == NULL) { break; |