Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/tls-maxphys]: src/sys/uvm Redo previous: it seems that the point of the ...



details:   https://anonhg.NetBSD.org/src/rev/8f4dee126886
branches:  tls-maxphys
changeset: 852926:8f4dee126886
user:      bouyer <bouyer%NetBSD.org@localhost>
date:      Tue Oct 09 21:37:47 2012 +0000

description:
Redo previous: it seems that the point of the bytelen computation was to
get transfers aligned to chunksz. So reintroduce the code, but using chunksz
instead of chunksize (if the readahead is trucated there's no point in
trying to align it anyway).
Now I get 64k read requests at the drive level again.

diffstat:

 sys/uvm/uvm_readahead.c |  20 +++++++++++++++-----
 1 files changed, 15 insertions(+), 5 deletions(-)

diffs (55 lines):

diff -r 01e97a009acf -r 8f4dee126886 sys/uvm/uvm_readahead.c
--- a/sys/uvm/uvm_readahead.c   Tue Oct 09 20:07:28 2012 +0000
+++ b/sys/uvm/uvm_readahead.c   Tue Oct 09 21:37:47 2012 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: uvm_readahead.c,v 1.8.12.2 2012/10/09 20:07:28 bouyer Exp $    */
+/*     $NetBSD: uvm_readahead.c,v 1.8.12.3 2012/10/09 21:37:47 bouyer Exp $    */
 
 /*-
  * Copyright (c)2003, 2005, 2009 YAMAMOTO Takashi,
@@ -40,7 +40,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: uvm_readahead.c,v 1.8.12.2 2012/10/09 20:07:28 bouyer Exp $");
+__KERNEL_RCSID(0, "$NetBSD: uvm_readahead.c,v 1.8.12.3 2012/10/09 21:37:47 bouyer Exp $");
 
 #include <sys/param.h>
 #include <sys/pool.h>
@@ -118,6 +118,7 @@
                size_t donebytes;
                int npages;
                int orignpages;
+               size_t bytelen;
 
                if ((chunksize & (PAGE_SIZE - 1)) != 0) {
                    panic("bad chunksize %d, iochunk %d, request size %d",
@@ -125,7 +126,16 @@
                }
                /* KASSERT((chunksize & (PAGE_SIZE - 1)) == 0); */
                KASSERT((off & PAGE_MASK) == 0);
-               npages = orignpages = chunksize >> PAGE_SHIFT;
+               KASSERT((chunksz & (chunksz - 1)) == 0);
+               bytelen = ((off + chunksz) & -(off_t)chunksz) - off;
+               if ((bytelen & PAGE_MASK) != 0) {
+                       panic("bad bytelen %d with off %d, chunksize %d"
+                           "(iochunk %d, sz %d)",
+                           (int)bytelen, (int)off, (int)chunksize,
+                           (int)chunksz, (int)sz);
+               }
+               KASSERT((bytelen & PAGE_MASK) == 0);
+               npages = orignpages = bytelen >> PAGE_SHIFT;
                KASSERT(npages != 0);
 
                /*
@@ -135,8 +145,8 @@
                mutex_enter(uobj->vmobjlock);
                error = (*uobj->pgops->pgo_get)(uobj, off, NULL,
                    &npages, 0, VM_PROT_READ, UVM_ADV_RANDOM, 0);
-               DPRINTF(("%s:  off=%" PRIu64 ", chunksize=%zu -> %d\n",
-                   __func__, off, chunksize, error));
+               DPRINTF(("%s:  off=%" PRIu64 ", bytelen=%zu -> %d\n",
+                   __func__, off, bytelen, error));
                if (error != 0 && error != EBUSY) {
                        if (error != EINVAL) { /* maybe past EOF */
                                DPRINTF(("%s: error=%d\n", __func__, error));



Home | Main Index | Thread Index | Old Index