aboutsummaryrefslogtreecommitdiff
path: root/sys
diff options
context:
space:
mode:
authorAlan Cox <alc@FreeBSD.org>2006-05-13 20:05:44 +0000
committerAlan Cox <alc@FreeBSD.org>2006-05-13 20:05:44 +0000
commit8f8790a76df782820bf474d4e10db351656fe13d (patch)
treed542856defd52c42899173a1f9493935be4fd76b /sys
parent1e1de0e499852a09a8c818e2caeb92be723517fb (diff)
downloadsrc-8f8790a76df782820bf474d4e10db351656fe13d.tar.gz
src-8f8790a76df782820bf474d4e10db351656fe13d.zip
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
Notes
Notes: svn path=/head/; revision=158525
Diffstat (limited to 'sys')
-rw-r--r--sys/vm/vm_fault.c17
1 files changed, 5 insertions, 12 deletions
diff --git a/sys/vm/vm_fault.c b/sys/vm/vm_fault.c
index 7417fc1c420c..2484af192ab4 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;