summaryrefslogtreecommitdiff
path: root/sys
diff options
context:
space:
mode:
authorTed Unangst <tedu@cvs.openbsd.org>2010-02-12 01:35:15 +0000
committerTed Unangst <tedu@cvs.openbsd.org>2010-02-12 01:35:15 +0000
commitcc3add828c9e58862c38e85f29502d15deb9e02f (patch)
tree050e6d7f86071b587a575afba4fe7d0ed425cdfa /sys
parent9efad3e8c16d3b2b5cef469bd993aeae73407e9a (diff)
introduce a uvm_km_valloc_try function that won't get a lower level lock
for use by the uvm pseg code. this is the path of least resistance until we sort out how many of these functions we really need. problem found by mikeb ok kettenis oga
Diffstat (limited to 'sys')
-rw-r--r--sys/arch/sparc64/sparc64/cpu.c4
-rw-r--r--sys/uvm/uvm_extern.h5
-rw-r--r--sys/uvm/uvm_km.c14
-rw-r--r--sys/uvm/uvm_pager.c4
4 files changed, 17 insertions, 10 deletions
diff --git a/sys/arch/sparc64/sparc64/cpu.c b/sys/arch/sparc64/sparc64/cpu.c
index ce987d10979..262bd01f3a6 100644
--- a/sys/arch/sparc64/sparc64/cpu.c
+++ b/sys/arch/sparc64/sparc64/cpu.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: cpu.c,v 1.53 2009/10/26 20:17:25 deraadt Exp $ */
+/* $OpenBSD: cpu.c,v 1.54 2010/02/12 01:35:14 tedu Exp $ */
/* $NetBSD: cpu.c,v 1.13 2001/05/26 21:27:15 chs Exp $ */
/*
@@ -136,7 +136,7 @@ alloc_cpuinfo(struct mainbus_attach_args *ma)
if (cpi->ci_upaid == portid)
return cpi;
- va = uvm_km_valloc_align(kernel_map, sz, 8 * PAGE_SIZE);
+ va = uvm_km_valloc_align(kernel_map, sz, 8 * PAGE_SIZE, 0);
if (va == 0)
panic("alloc_cpuinfo: no virtual space");
va0 = va;
diff --git a/sys/uvm/uvm_extern.h b/sys/uvm/uvm_extern.h
index 6c514abcf1e..010cbeec931 100644
--- a/sys/uvm/uvm_extern.h
+++ b/sys/uvm/uvm_extern.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: uvm_extern.h,v 1.82 2009/08/11 18:43:33 blambert Exp $ */
+/* $OpenBSD: uvm_extern.h,v 1.83 2010/02/12 01:35:14 tedu Exp $ */
/* $NetBSD: uvm_extern.h,v 1.57 2001/03/09 01:02:12 chs Exp $ */
/*
@@ -517,8 +517,9 @@ struct vm_map *uvm_km_suballoc(vm_map_t, vaddr_t *,
vaddr_t *, vsize_t, int,
boolean_t, vm_map_t);
vaddr_t uvm_km_valloc(vm_map_t, vsize_t);
-vaddr_t uvm_km_valloc_align(vm_map_t, vsize_t, vsize_t);
+vaddr_t uvm_km_valloc_try(vm_map_t, vsize_t);
vaddr_t uvm_km_valloc_wait(vm_map_t, vsize_t);
+vaddr_t uvm_km_valloc_align(struct vm_map *, vsize_t, vsize_t, int);
vaddr_t uvm_km_valloc_prefer_wait(vm_map_t, vsize_t,
voff_t);
void *uvm_km_getpage(boolean_t, int *);
diff --git a/sys/uvm/uvm_km.c b/sys/uvm/uvm_km.c
index b7604518559..e00ee709591 100644
--- a/sys/uvm/uvm_km.c
+++ b/sys/uvm/uvm_km.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: uvm_km.c,v 1.75 2009/07/25 12:55:40 miod Exp $ */
+/* $OpenBSD: uvm_km.c,v 1.76 2010/02/12 01:35:14 tedu Exp $ */
/* $NetBSD: uvm_km.c,v 1.42 2001/01/14 02:10:01 thorpej Exp $ */
/*
@@ -571,11 +571,17 @@ uvm_km_alloc1(struct vm_map *map, vsize_t size, vsize_t align, boolean_t zeroit)
vaddr_t
uvm_km_valloc(struct vm_map *map, vsize_t size)
{
- return(uvm_km_valloc_align(map, size, 0));
+ return(uvm_km_valloc_align(map, size, 0, 0));
}
vaddr_t
-uvm_km_valloc_align(struct vm_map *map, vsize_t size, vsize_t align)
+uvm_km_valloc_try(struct vm_map *map, vsize_t size)
+{
+ return(uvm_km_valloc_align(map, size, 0, UVM_FLAG_TRYLOCK));
+}
+
+vaddr_t
+uvm_km_valloc_align(struct vm_map *map, vsize_t size, vsize_t align, int flags)
{
vaddr_t kva;
UVMHIST_FUNC("uvm_km_valloc"); UVMHIST_CALLED(maphist);
@@ -592,7 +598,7 @@ uvm_km_valloc_align(struct vm_map *map, vsize_t size, vsize_t align)
if (__predict_false(uvm_map(map, &kva, size, uvm.kernel_object,
UVM_UNKNOWN_OFFSET, align, UVM_MAPFLAG(UVM_PROT_ALL, UVM_PROT_ALL,
- UVM_INH_NONE, UVM_ADV_RANDOM, 0)) != 0)) {
+ UVM_INH_NONE, UVM_ADV_RANDOM, flags)) != 0)) {
UVMHIST_LOG(maphist, "<- done (no VM)", 0,0,0,0);
return(0);
}
diff --git a/sys/uvm/uvm_pager.c b/sys/uvm/uvm_pager.c
index ee9048b63d2..b31918231de 100644
--- a/sys/uvm/uvm_pager.c
+++ b/sys/uvm/uvm_pager.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: uvm_pager.c,v 1.54 2009/07/22 21:05:37 oga Exp $ */
+/* $OpenBSD: uvm_pager.c,v 1.55 2010/02/12 01:35:14 tedu Exp $ */
/* $NetBSD: uvm_pager.c,v 1.36 2000/11/27 18:26:41 chs Exp $ */
/*
@@ -138,7 +138,7 @@ uvm_pseg_init(struct uvm_pseg *pseg)
{
KASSERT(pseg->start == 0);
KASSERT(pseg->use == 0);
- pseg->start = uvm_km_valloc(kernel_map, MAX_PAGER_SEGS * MAXBSIZE);
+ pseg->start = uvm_km_valloc_try(kernel_map, MAX_PAGER_SEGS * MAXBSIZE);
}
/*