Source-Changes-HG archive

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

[src/trunk]: src/sys/arch/sh3/sh3 Small optimization in vmapbuf()/vunmapbuf().



details:   https://anonhg.NetBSD.org/src/rev/d16806b13287
branches:  trunk
changeset: 572643:d16806b13287
user:      tsutsui <tsutsui%NetBSD.org@localhost>
date:      Sun Jan 09 17:41:34 2005 +0000

description:
Small optimization in vmapbuf()/vunmapbuf().

BTW, should we also pass 'VM_PROT_READ|VM_PROT_WRITE' to flags
with PMAP_WIRED for pmap_enter() in vmapbuf()?

diffstat:

 sys/arch/sh3/sh3/vm_machdep.c |  20 ++++++++++++--------
 1 files changed, 12 insertions(+), 8 deletions(-)

diffs (67 lines):

diff -r d02d111bfdc5 -r d16806b13287 sys/arch/sh3/sh3/vm_machdep.c
--- a/sys/arch/sh3/sh3/vm_machdep.c     Sun Jan 09 17:41:19 2005 +0000
+++ b/sys/arch/sh3/sh3/vm_machdep.c     Sun Jan 09 17:41:34 2005 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: vm_machdep.c,v 1.45 2004/09/17 14:11:22 skrll Exp $    */
+/*     $NetBSD: vm_machdep.c,v 1.46 2005/01/09 17:41:34 tsutsui Exp $  */
 
 /*-
  * Copyright (c) 2002 The NetBSD Foundation, Inc. All rights reserved.
@@ -81,7 +81,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: vm_machdep.c,v 1.45 2004/09/17 14:11:22 skrll Exp $");
+__KERNEL_RCSID(0, "$NetBSD: vm_machdep.c,v 1.46 2005/01/09 17:41:34 tsutsui Exp $");
 
 #include "opt_kstack_debug.h"
 
@@ -379,6 +379,7 @@
 {
        vaddr_t faddr, taddr, off;
        paddr_t fpa;
+       pmap_t kpmap, upmap;
 
        if ((bp->b_flags & B_PHYS) == 0)
                panic("vmapbuf");
@@ -399,16 +400,17 @@
         * where we we just allocated (TLB will be flushed when our
         * mapping is removed).
         */
+       upmap = vm_map_pmap(&bp->b_proc->p_vmspace->vm_map);
+       kpmap = vm_map_pmap(phys_map);
        while (len) {
-               pmap_extract(vm_map_pmap(&bp->b_proc->p_vmspace->vm_map),
-                            faddr, &fpa);
-               pmap_enter(vm_map_pmap(phys_map), taddr, fpa,
+               pmap_extract(upmap, faddr, &fpa);
+               pmap_enter(kpmap, taddr, fpa,
                    VM_PROT_READ | VM_PROT_WRITE, PMAP_WIRED);
                faddr += PAGE_SIZE;
                taddr += PAGE_SIZE;
                len -= PAGE_SIZE;
        }
-       pmap_update(vm_map_pmap(phys_map));
+       pmap_update(kpmap);
 }
 
 /*
@@ -419,14 +421,16 @@
 vunmapbuf(struct buf *bp, vsize_t len)
 {
        vaddr_t addr, off;
+       pmap_t kpmap;
 
        if ((bp->b_flags & B_PHYS) == 0)
                panic("vunmapbuf");
        addr = trunc_page((vaddr_t)bp->b_data);
        off = (vaddr_t)bp->b_data - addr;
        len = round_page(off + len);
-       pmap_remove(vm_map_pmap(phys_map), addr, addr + len);
-       pmap_update(vm_map_pmap(phys_map));
+       kpmap = vm_map_pmap(phys_map);
+       pmap_remove(kpmap, addr, addr + len);
+       pmap_update(kpmap);
        uvm_km_free_wakeup(phys_map, addr, len);
        bp->b_data = bp->b_saveaddr;
        bp->b_saveaddr = 0;



Home | Main Index | Thread Index | Old Index