Source-Changes-HG archive

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

[src/trunk]: src/sys/uvm Calculate the offset from vm_map_entry's start to vm...



details:   https://anonhg.NetBSD.org/src/rev/e72d81d56460
branches:  trunk
changeset: 751257:e72d81d56460
user:      uebayasi <uebayasi%NetBSD.org@localhost>
date:      Sat Jan 30 15:13:25 2010 +0000

description:
Calculate the offset from vm_map_entry's start to vm_page array's start once.

diffstat:

 sys/uvm/uvm_fault.c |  14 +++++++-------
 1 files changed, 7 insertions(+), 7 deletions(-)

diffs (56 lines):

diff -r ce071d7c6fc3 -r e72d81d56460 sys/uvm/uvm_fault.c
--- a/sys/uvm/uvm_fault.c       Sat Jan 30 12:06:20 2010 +0000
+++ b/sys/uvm/uvm_fault.c       Sat Jan 30 15:13:25 2010 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: uvm_fault.c,v 1.130 2010/01/24 15:03:02 uebayasi Exp $ */
+/*     $NetBSD: uvm_fault.c,v 1.131 2010/01/30 15:13:25 uebayasi Exp $ */
 
 /*
  *
@@ -39,7 +39,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: uvm_fault.c,v 1.130 2010/01/24 15:03:02 uebayasi Exp $");
+__KERNEL_RCSID(0, "$NetBSD: uvm_fault.c,v 1.131 2010/01/30 15:13:25 uebayasi Exp $");
 
 #include "opt_uvmhist.h"
 
@@ -872,6 +872,8 @@
                centeridx = 0;
 
        }
+       /* offset from entry's start to pgs' start */
+       const voff_t eoff = startva - ufi.entry->start;
 
        /* locked: maps(read) */
        UVMHIST_LOG(maphist, "  narrow=%d, back=%d, forw=%d, startva=0x%x",
@@ -886,8 +888,7 @@
        if (amap) {
                amap_lock(amap);
                anons = anons_store;
-               amap_lookups(&ufi.entry->aref, startva - ufi.entry->start,
-                   anons, npages);
+               amap_lookups(&ufi.entry->aref, eoff, anons, npages);
        } else {
                anons = NULL;   /* to be safe */
        }
@@ -910,7 +911,7 @@
 
                /* flush object? */
                if (uobj) {
-                       uoff = (startva - ufi.entry->start) + ufi.entry->offset;
+                       uoff = ufi.entry->offset + eoff;
                        mutex_enter(&uobj->vmobjlock);
                        (void) (uobj->pgops->pgo_put)(uobj, uoff, uoff +
                                    (nback << PAGE_SHIFT), PGO_DEACTIVATE);
@@ -1049,8 +1050,7 @@
 
                uvmexp.fltlget++;
                gotpages = npages;
-               (void) uobj->pgops->pgo_get(uobj, ufi.entry->offset +
-                               (startva - ufi.entry->start),
+               (void) uobj->pgops->pgo_get(uobj, ufi.entry->offset + eoff,
                                pages, &gotpages, centeridx,
                                access_type & MASK(ufi.entry),
                                ufi.entry->advice, PGO_LOCKED);



Home | Main Index | Thread Index | Old Index