summaryrefslogtreecommitdiff
path: root/sys/uvm
diff options
context:
space:
mode:
authorOwain Ainsworth <oga@cvs.openbsd.org>2009-04-14 16:01:05 +0000
committerOwain Ainsworth <oga@cvs.openbsd.org>2009-04-14 16:01:05 +0000
commit736b9535289dd9e3a0ffaafbb736c868a7f377d6 (patch)
tree608c5bb2fc645051c56618391202edc1c0f9e6e8 /sys/uvm
parent1b91dd8d89d56b40421b288402b14602db6d9a0f (diff)
Convert the waitok field of uvm_pglistalloc to "flags", more will be added soon.
For the possibility of sleeping, the first two flags are UVM_PLA_WAITOK and UVM_PLA_NOWAIT. It is an error not to show intention, so assert that one of the two is provided. Switch over every caller in the tree to using the appropriate flag. ok art@, ariane@
Diffstat (limited to 'sys/uvm')
-rw-r--r--sys/uvm/uvm_extern.h8
-rw-r--r--sys/uvm/uvm_pglist.c9
2 files changed, 14 insertions, 3 deletions
diff --git a/sys/uvm/uvm_extern.h b/sys/uvm/uvm_extern.h
index 2e97ced5933..95cd3fa3fe2 100644
--- a/sys/uvm/uvm_extern.h
+++ b/sys/uvm/uvm_extern.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: uvm_extern.h,v 1.74 2009/03/05 19:52:24 kettenis Exp $ */
+/* $OpenBSD: uvm_extern.h,v 1.75 2009/04/14 16:01:04 oga Exp $ */
/* $NetBSD: uvm_extern.h,v 1.57 2001/03/09 01:02:12 chs Exp $ */
/*
@@ -221,6 +221,12 @@ typedef int vm_prot_t;
#define UVM_PGA_ZERO 0x0002 /* returned page must be zeroed */
/*
+ * flags for uvm_pglistalloc()
+ */
+#define UVM_PLA_WAITOK 0x0001 /* may sleep */
+#define UVM_PLA_NOWAIT 0x0002 /* can't sleep (need one of the two) */
+
+/*
* lockflags that control the locking behavior of various functions.
*/
#define UVM_LK_ENTER 0x00000001 /* map locked on entry */
diff --git a/sys/uvm/uvm_pglist.c b/sys/uvm/uvm_pglist.c
index 94d5d732314..b1b4286a243 100644
--- a/sys/uvm/uvm_pglist.c
+++ b/sys/uvm/uvm_pglist.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: uvm_pglist.c,v 1.25 2009/03/20 15:19:04 oga Exp $ */
+/* $OpenBSD: uvm_pglist.c,v 1.26 2009/04/14 16:01:04 oga Exp $ */
/* $NetBSD: uvm_pglist.c,v 1.13 2001/02/18 21:19:08 chs Exp $ */
/*-
@@ -184,7 +184,7 @@ out:
int
uvm_pglistalloc(psize_t size, paddr_t low, paddr_t high, paddr_t alignment,
- paddr_t boundary, struct pglist *rlist, int nsegs, int waitok)
+ paddr_t boundary, struct pglist *rlist, int nsegs, int flags)
{
int psi;
struct vm_page *pgs;
@@ -201,6 +201,11 @@ uvm_pglistalloc(psize_t size, paddr_t low, paddr_t high, paddr_t alignment,
KASSERT((alignment & (alignment - 1)) == 0);
KASSERT((boundary & (boundary - 1)) == 0);
+ /*
+ * This argument is always ignored for now, but ensure drivers always
+ * show intention.
+ */
+ KASSERT(!(flags & UVM_PLA_WAITOK) ^ !(flags & UVM_PLA_NOWAIT));
/*
* Our allocations are always page granularity, so our alignment