diff options
author | Artur Grabowski <art@cvs.openbsd.org> | 2000-02-18 17:40:05 +0000 |
---|---|---|
committer | Artur Grabowski <art@cvs.openbsd.org> | 2000-02-18 17:40:05 +0000 |
commit | 60e7df64951fe4e96443fc3102895009e5b9374e (patch) | |
tree | 3fc390b1452e81060a2a62f5c0cb5db74bd829d3 /sys/arch | |
parent | cd40c4af7f6b2f76a48c527c36bb576d98a06696 (diff) |
In vmapbuf expand uvm_km_valloc_wait into a direct call to uvm_map
so that we can specify an offset. This allows uvm_map to use PMAP_PREFER
and removes a big source of bad cache aliases.
With this change I have not seen any bad cache aliases during normal use.
(it is still possible to force them).
Diffstat (limited to 'sys/arch')
-rw-r--r-- | sys/arch/sparc/sparc/vm_machdep.c | 27 |
1 files changed, 20 insertions, 7 deletions
diff --git a/sys/arch/sparc/sparc/vm_machdep.c b/sys/arch/sparc/sparc/vm_machdep.c index 45d30dd45ef..bd296ac66d0 100644 --- a/sys/arch/sparc/sparc/vm_machdep.c +++ b/sys/arch/sparc/sparc/vm_machdep.c @@ -1,4 +1,4 @@ -/* $OpenBSD: vm_machdep.c,v 1.14 2000/02/17 20:18:00 art Exp $ */ +/* $OpenBSD: vm_machdep.c,v 1.15 2000/02/18 17:40:04 art Exp $ */ /* $NetBSD: vm_machdep.c,v 1.30 1997/03/10 23:55:40 pk Exp $ */ /* @@ -277,15 +277,15 @@ dvma_mapout(kva, va, len) /*ARGSUSED*/ void vmapbuf(bp, sz) - register struct buf *bp; + struct buf *bp; vsize_t sz; { - register vaddr_t addr, kva; + vaddr_t addr, kva; paddr_t pa; - register vsize_t size, off; - register int npf; + vsize_t size, off; + int npf; struct proc *p; - register struct vm_map *map; + struct vm_map *map; #ifdef DIAGNOSTIC if ((bp->b_flags & B_PHYS) == 0) @@ -298,7 +298,20 @@ vmapbuf(bp, sz) off = addr & PGOFSET; size = round_page(bp->b_bcount + off); #if defined(UVM) - kva = uvm_km_valloc_wait(kernel_map, size); + /* + * Note that this is an expanded version of: + * kva = uvm_km_valloc_wait(kernel_map, size); + * We do it on our own here to be able to specify an offset to uvm_map + * so that we can get all benefits of PMAP_PREFER. + */ + while (1) { + kva = vm_map_min(kernel_map); + if (uvm_map(kernel_map, &kva, size, NULL, addr, + UVM_MAPFLAG(UVM_PROT_ALL, UVM_PROT_ALL, + UVM_INH_NONE, UVM_ADV_RANDOM, 0)) == KERN_SUCCESS) + break; + tsleep(kernel_map, PVM, "vallocwait", 0); + } #else kva = kmem_alloc_wait(kernel_map, size); #endif |