diff options
author | dyson <dyson@FreeBSD.org> | 1995-09-04 04:44:26 +0000 |
---|---|---|
committer | dyson <dyson@FreeBSD.org> | 1995-09-04 04:44:26 +0000 |
commit | 3f4ad92abfd77b9640f90ee1b2d4c70c6f216299 (patch) | |
tree | 4d4a3509a8ac3ac88a9217d27c9a57467bbe2948 /sys/vm/vm_fault.c | |
parent | 2b7d20007cfb0efb0045acf15067b0788d93a410 (diff) | |
download | FreeBSD-src-3f4ad92abfd77b9640f90ee1b2d4c70c6f216299.zip FreeBSD-src-3f4ad92abfd77b9640f90ee1b2d4c70c6f216299.tar.gz |
Allow the fault code to use additional clustering info from both
bmap and the swap pager. Improved fault clustering performance.
Diffstat (limited to 'sys/vm/vm_fault.c')
-rw-r--r-- | sys/vm/vm_fault.c | 31 |
1 files changed, 25 insertions, 6 deletions
diff --git a/sys/vm/vm_fault.c b/sys/vm/vm_fault.c index 1fa59dc..65efdfb 100644 --- a/sys/vm/vm_fault.c +++ b/sys/vm/vm_fault.c @@ -66,7 +66,7 @@ * any improvements or extensions that they make and grant Carnegie the * rights to redistribute these changes. * - * $Id: vm_fault.c,v 1.26 1995/07/13 08:48:20 davidg Exp $ + * $Id: vm_fault.c,v 1.27 1995/09/03 20:40:41 dyson Exp $ */ /* @@ -883,7 +883,7 @@ vm_fault_page_lookup(object, offset, rtobject, rtoffset, rtm) *rtoffset = offset; return 1; } - if (!object->backing_object) + if (!object->backing_object || (object == *rtobject)) return 0; else { offset += object->backing_object_offset; @@ -928,6 +928,7 @@ vm_fault_additional_pages(first_object, first_offset, m, rbehind, raheada, marra vm_offset_t offsetdiff; int rahead; int treqpage; + int cbehind, cahead; object = m->object; offset = m->offset; @@ -938,9 +939,19 @@ vm_fault_additional_pages(first_object, first_offset, m, rbehind, raheada, marra * if the requested page is not available, then give up now */ - if (!vm_pager_has_page(object, object->paging_offset + offset, NULL, NULL)) + if (!vm_pager_has_page(object, + object->paging_offset + offset, &cbehind, &cahead)) return 0; + if (object->backing_object == NULL) { + if (raheada > cahead) { + raheada = cahead; + } + if (rbehind > cbehind) { + rbehind = cbehind; + } + } + /* * try to do any readahead that we might have free pages for. */ @@ -969,6 +980,7 @@ vm_fault_additional_pages(first_object, first_offset, m, rbehind, raheada, marra rbehind = offset / NBPG; startoffset = offset - rbehind * NBPG; while (toffset >= startoffset) { + rtobject = object; if (!vm_fault_page_lookup(first_object, toffset - offsetdiff, &rtobject, &rtoffset, &rtm) || rtm != 0 || rtobject != object) { startoffset = toffset + NBPG; @@ -989,6 +1001,7 @@ vm_fault_additional_pages(first_object, first_offset, m, rbehind, raheada, marra toffset = offset + NBPG; endoffset = offset + (rahead + 1) * NBPG; while (toffset < object->size && toffset < endoffset) { + rtobject = object; if (!vm_fault_page_lookup(first_object, toffset - offsetdiff, &rtobject, &rtoffset, &rtm) || rtm != 0 || rtobject != object) { break; @@ -1010,10 +1023,14 @@ vm_fault_additional_pages(first_object, first_offset, m, rbehind, raheada, marra * get our pages and don't block for them */ for (i = 0; i < size; i++) { - if (i != treqpage) + if (i != treqpage) { rtm = vm_page_alloc(object, startoffset + i * NBPG, VM_ALLOC_NORMAL); - else + if (rtm == NULL) + break; + } else { rtm = m; + } + marray[i] = rtm; } @@ -1026,7 +1043,7 @@ vm_fault_additional_pages(first_object, first_offset, m, rbehind, raheada, marra * if we could not get our block of pages, then free the * readahead/readbehind pages. */ - if (i < size) { + if (i < treqpage) { for (i = 0; i < size; i++) { if (i != treqpage && marray[i]) FREE_PAGE(marray[i]); @@ -1035,6 +1052,8 @@ vm_fault_additional_pages(first_object, first_offset, m, rbehind, raheada, marra marray[0] = m; return 1; } + + size = i; *reqpage = treqpage; return size; } |