summaryrefslogtreecommitdiff
path: root/sys/uvm
diff options
context:
space:
mode:
authorPhilip Guenther <guenther@cvs.openbsd.org>2014-12-17 06:58:12 +0000
committerPhilip Guenther <guenther@cvs.openbsd.org>2014-12-17 06:58:12 +0000
commita45b759c4782fe513ec89d5d4bb06bf38784f061 (patch)
tree2f819accb4d69bd46127e29bbe803b2c5e5ad7ae /sys/uvm
parent055668cf6b0974a1072d2833eb7db870dc7f43be (diff)
Prefer MADV_* over POSIX_MADV_* in kernel for consistency: the latter
doesn't have all the values and therefore can't be used everywhere. ok deraadt@ kettenis@
Diffstat (limited to 'sys/uvm')
-rw-r--r--sys/uvm/uvm_fault.c10
-rw-r--r--sys/uvm/uvm_init.c6
-rw-r--r--sys/uvm/uvm_km.c34
-rw-r--r--sys/uvm/uvm_mmap.c6
-rw-r--r--sys/uvm/uvm_object.c4
-rw-r--r--sys/uvm/uvm_unix.c4
6 files changed, 30 insertions, 34 deletions
diff --git a/sys/uvm/uvm_fault.c b/sys/uvm/uvm_fault.c
index fb6179393c1..ffc5949a65e 100644
--- a/sys/uvm/uvm_fault.c
+++ b/sys/uvm/uvm_fault.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: uvm_fault.c,v 1.80 2014/12/15 02:24:23 guenther Exp $ */
+/* $OpenBSD: uvm_fault.c,v 1.81 2014/12/17 06:58:11 guenther Exp $ */
/* $NetBSD: uvm_fault.c,v 1.51 2000/08/06 00:22:53 thorpej Exp $ */
/*
@@ -206,15 +206,15 @@ uvmfault_init()
npages = atop(16384);
if (npages > 0) {
KASSERT(npages <= UVM_MAXRANGE / 2);
- uvmadvice[POSIX_MADV_NORMAL].nforw = npages;
- uvmadvice[POSIX_MADV_NORMAL].nback = npages - 1;
+ uvmadvice[MADV_NORMAL].nforw = npages;
+ uvmadvice[MADV_NORMAL].nback = npages - 1;
}
npages = atop(32768);
if (npages > 0) {
KASSERT(npages <= UVM_MAXRANGE / 2);
- uvmadvice[POSIX_MADV_SEQUENTIAL].nforw = npages - 1;
- uvmadvice[POSIX_MADV_SEQUENTIAL].nback = npages;
+ uvmadvice[MADV_SEQUENTIAL].nforw = npages - 1;
+ uvmadvice[MADV_SEQUENTIAL].nback = npages;
}
}
diff --git a/sys/uvm/uvm_init.c b/sys/uvm/uvm_init.c
index 6efe21078e8..f3628aade7b 100644
--- a/sys/uvm/uvm_init.c
+++ b/sys/uvm/uvm_init.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: uvm_init.c,v 1.36 2014/12/15 02:24:23 guenther Exp $ */
+/* $OpenBSD: uvm_init.c,v 1.37 2014/12/17 06:58:11 guenther Exp $ */
/* $NetBSD: uvm_init.c,v 1.14 2000/06/27 17:29:23 mrg Exp $ */
/*
@@ -148,14 +148,14 @@ uvm_init(void)
kvm_start = trunc_page(DEADBEEF0) - PAGE_SIZE;
if (uvm_map(kernel_map, &kvm_start, 3 * PAGE_SIZE,
NULL, UVM_UNKNOWN_OFFSET, 0, UVM_MAPFLAG(PROT_NONE,
- PROT_NONE, MAP_INHERIT_NONE, POSIX_MADV_RANDOM, UVM_FLAG_FIXED)))
+ PROT_NONE, MAP_INHERIT_NONE, MADV_RANDOM, UVM_FLAG_FIXED)))
panic("uvm_init: cannot reserve dead beef @0x%x", DEADBEEF0);
#endif
#ifdef DEADBEEF1
kvm_start = trunc_page(DEADBEEF1) - PAGE_SIZE;
if (uvm_map(kernel_map, &kvm_start, 3 * PAGE_SIZE,
NULL, UVM_UNKNOWN_OFFSET, 0, UVM_MAPFLAG(PROT_NONE,
- PROT_NONE, MAP_INHERIT_NONE, POSIX_MADV_RANDOM, UVM_FLAG_FIXED)))
+ PROT_NONE, MAP_INHERIT_NONE, MADV_RANDOM, UVM_FLAG_FIXED)))
panic("uvm_init: cannot reserve dead beef @0x%x", DEADBEEF1);
#endif
/*
diff --git a/sys/uvm/uvm_km.c b/sys/uvm/uvm_km.c
index 53ddeef501c..6266c8d9c37 100644
--- a/sys/uvm/uvm_km.c
+++ b/sys/uvm/uvm_km.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: uvm_km.c,v 1.122 2014/12/15 02:24:23 guenther Exp $ */
+/* $OpenBSD: uvm_km.c,v 1.123 2014/12/17 06:58:11 guenther Exp $ */
/* $NetBSD: uvm_km.c,v 1.42 2001/01/14 02:10:01 thorpej Exp $ */
/*
@@ -184,7 +184,7 @@ uvm_km_init(vaddr_t start, vaddr_t end)
if (base != start && uvm_map(&kernel_map_store, &base, start - base,
NULL, UVM_UNKNOWN_OFFSET, 0,
UVM_MAPFLAG(PROT_READ | PROT_WRITE, PROT_READ | PROT_WRITE,
- MAP_INHERIT_NONE, POSIX_MADV_RANDOM, UVM_FLAG_FIXED)) != 0)
+ MAP_INHERIT_NONE, MADV_RANDOM, UVM_FLAG_FIXED)) != 0)
panic("uvm_km_init: could not reserve space for kernel");
kernel_map = &kernel_map_store;
@@ -210,9 +210,8 @@ uvm_km_suballoc(struct vm_map *map, vaddr_t *min, vaddr_t *max, vsize_t size,
/* first allocate a blank spot in the parent map */
if (uvm_map(map, min, size, NULL, UVM_UNKNOWN_OFFSET, 0,
- UVM_MAPFLAG(PROT_READ | PROT_WRITE,
- PROT_READ | PROT_WRITE, MAP_INHERIT_NONE,
- POSIX_MADV_RANDOM, mapflags)) != 0) {
+ UVM_MAPFLAG(PROT_READ | PROT_WRITE, PROT_READ | PROT_WRITE,
+ MAP_INHERIT_NONE, MADV_RANDOM, mapflags)) != 0) {
panic("uvm_km_suballoc: unable to allocate space in parent map");
}
@@ -340,9 +339,8 @@ uvm_km_kmemalloc_pla(struct vm_map *map, struct uvm_object *obj, vsize_t size,
/* allocate some virtual space */
if (__predict_false(uvm_map(map, &kva, size, obj, UVM_UNKNOWN_OFFSET,
- valign, UVM_MAPFLAG(PROT_READ | PROT_WRITE,
- PROT_READ | PROT_WRITE, MAP_INHERIT_NONE,
- POSIX_MADV_RANDOM, (flags & UVM_KMF_TRYLOCK))) != 0)) {
+ valign, UVM_MAPFLAG(PROT_READ | PROT_WRITE, PROT_READ | PROT_WRITE,
+ MAP_INHERIT_NONE, MADV_RANDOM, (flags & UVM_KMF_TRYLOCK))) != 0)) {
return(0);
}
@@ -460,7 +458,7 @@ uvm_km_alloc1(struct vm_map *map, vsize_t size, vsize_t align, boolean_t zeroit)
UVM_UNKNOWN_OFFSET, align,
UVM_MAPFLAG(PROT_READ | PROT_WRITE,
PROT_READ | PROT_WRITE | PROT_EXEC,
- MAP_INHERIT_NONE, POSIX_MADV_RANDOM, 0)) != 0)) {
+ MAP_INHERIT_NONE, MADV_RANDOM, 0)) != 0)) {
return(0);
}
@@ -548,7 +546,7 @@ uvm_km_valloc_align(struct vm_map *map, vsize_t size, vsize_t align, int flags)
if (__predict_false(uvm_map(map, &kva, size, uvm.kernel_object,
UVM_UNKNOWN_OFFSET, align,
UVM_MAPFLAG(PROT_READ | PROT_WRITE, PROT_READ | PROT_WRITE,
- MAP_INHERIT_NONE, POSIX_MADV_RANDOM, flags)) != 0)) {
+ MAP_INHERIT_NONE, MADV_RANDOM, flags)) != 0)) {
return(0);
}
@@ -583,7 +581,7 @@ uvm_km_valloc_prefer_wait(struct vm_map *map, vsize_t size, voff_t prefer)
if (__predict_true(uvm_map(map, &kva, size, uvm.kernel_object,
prefer, 0,
UVM_MAPFLAG(PROT_READ | PROT_WRITE, PROT_READ | PROT_WRITE,
- MAP_INHERIT_NONE, POSIX_MADV_RANDOM, 0)) == 0)) {
+ MAP_INHERIT_NONE, MADV_RANDOM, 0)) == 0)) {
return(kva);
}
@@ -668,7 +666,7 @@ uvm_km_page_init(void)
NULL, UVM_UNKNOWN_OFFSET, 0,
UVM_MAPFLAG(PROT_READ | PROT_WRITE,
PROT_READ | PROT_WRITE, MAP_INHERIT_NONE,
- POSIX_MADV_RANDOM, UVM_KMF_TRYLOCK)) != 0) {
+ MADV_RANDOM, UVM_KMF_TRYLOCK)) != 0) {
bulk /= 2;
continue;
}
@@ -731,9 +729,8 @@ uvm_km_thread(void *arg)
* if fp != NULL
*/
flags = UVM_MAPFLAG(PROT_READ | PROT_WRITE,
- PROT_READ | PROT_WRITE,
- MAP_INHERIT_NONE, POSIX_MADV_RANDOM,
- fp != NULL ? UVM_KMF_TRYLOCK : 0);
+ PROT_READ | PROT_WRITE, MAP_INHERIT_NONE,
+ MADV_RANDOM, fp != NULL ? UVM_KMF_TRYLOCK : 0);
memset(pg, 0, sizeof(pg));
for (i = 0; i < nitems(pg); i++) {
pg[i] = vm_map_min(kernel_map);
@@ -745,9 +742,8 @@ uvm_km_thread(void *arg)
/* made progress, so don't sleep for more */
flags = UVM_MAPFLAG(PROT_READ | PROT_WRITE,
- PROT_READ | PROT_WRITE,
- MAP_INHERIT_NONE, POSIX_MADV_RANDOM,
- UVM_KMF_TRYLOCK);
+ PROT_READ | PROT_WRITE, MAP_INHERIT_NONE,
+ MADV_RANDOM, UVM_KMF_TRYLOCK);
}
mtx_enter(&uvm_km_pages.mtx);
@@ -921,7 +917,7 @@ try_map:
va = vm_map_min(map);
if (uvm_map(map, &va, sz, uobj, kd->kd_prefer,
kv->kv_align, UVM_MAPFLAG(prot, prot, MAP_INHERIT_NONE,
- POSIX_MADV_RANDOM, mapflags))) {
+ MADV_RANDOM, mapflags))) {
if (kv->kv_wait && kd->kd_waitok) {
tsleep(map, PVM, "km_allocva", 0);
goto try_map;
diff --git a/sys/uvm/uvm_mmap.c b/sys/uvm/uvm_mmap.c
index 3912d34dd39..7fa7bfe4e1e 100644
--- a/sys/uvm/uvm_mmap.c
+++ b/sys/uvm/uvm_mmap.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: uvm_mmap.c,v 1.103 2014/12/16 18:30:04 tedu Exp $ */
+/* $OpenBSD: uvm_mmap.c,v 1.104 2014/12/17 06:58:11 guenther Exp $ */
/* $NetBSD: uvm_mmap.c,v 1.49 2001/02/18 21:19:08 chs Exp $ */
/*
@@ -903,7 +903,7 @@ uvm_mmap(vm_map_t map, vaddr_t *addr, vsize_t size, vm_prot_t prot,
struct uvm_object *uobj;
struct vnode *vp;
int error;
- int advice = POSIX_MADV_NORMAL;
+ int advice = MADV_NORMAL;
uvm_flag_t uvmflag = 0;
vsize_t align = 0; /* userland page size */
@@ -995,7 +995,7 @@ uvm_mmap(vm_map_t map, vaddr_t *addr, vsize_t size, vm_prot_t prot,
(flags & MAP_SHARED) ? maxprot :
(maxprot & ~PROT_WRITE), foff, size);
}
- advice = POSIX_MADV_RANDOM;
+ advice = MADV_RANDOM;
}
if (uobj == NULL)
diff --git a/sys/uvm/uvm_object.c b/sys/uvm/uvm_object.c
index 0e8246998eb..519a8e585bc 100644
--- a/sys/uvm/uvm_object.c
+++ b/sys/uvm/uvm_object.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: uvm_object.c,v 1.10 2014/11/16 12:31:00 deraadt Exp $ */
+/* $OpenBSD: uvm_object.c,v 1.11 2014/12/17 06:58:11 guenther Exp $ */
/*
* Copyright (c) 2006 The NetBSD Foundation, Inc.
@@ -80,7 +80,7 @@ uvm_objwire(struct uvm_object *uobj, voff_t start, voff_t end,
/* Get the pages */
memset(pgs, 0, sizeof(pgs));
error = (*uobj->pgops->pgo_get)(uobj, offset, pgs, &npages, 0,
- PROT_READ | PROT_WRITE, POSIX_MADV_SEQUENTIAL,
+ PROT_READ | PROT_WRITE, MADV_SEQUENTIAL,
PGO_ALLPAGES | PGO_SYNCIO);
if (error)
diff --git a/sys/uvm/uvm_unix.c b/sys/uvm/uvm_unix.c
index 4e28942df14..3bc74bcbc41 100644
--- a/sys/uvm/uvm_unix.c
+++ b/sys/uvm/uvm_unix.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: uvm_unix.c,v 1.53 2014/12/15 02:24:23 guenther Exp $ */
+/* $OpenBSD: uvm_unix.c,v 1.54 2014/12/17 06:58:11 guenther Exp $ */
/* $NetBSD: uvm_unix.c,v 1.18 2000/09/13 15:00:25 thorpej Exp $ */
/*
@@ -87,7 +87,7 @@ sys_obreak(struct proc *p, void *v, register_t *retval)
UVM_UNKNOWN_OFFSET, 0,
UVM_MAPFLAG(PROT_READ | PROT_WRITE,
PROT_READ | PROT_WRITE | PROT_EXEC, MAP_INHERIT_COPY,
- POSIX_MADV_NORMAL, UVM_FLAG_AMAPPAD|UVM_FLAG_FIXED|
+ MADV_NORMAL, UVM_FLAG_AMAPPAD|UVM_FLAG_FIXED|
UVM_FLAG_OVERLAY|UVM_FLAG_COPYONW));
if (error) {
uprintf("sbrk: grow %ld failed, error = %d\n",