summaryrefslogtreecommitdiffstats
path: root/sys
diff options
context:
space:
mode:
authorcheloha <cheloha@openbsd.org>2019-07-18 23:47:33 +0000
committercheloha <cheloha@openbsd.org>2019-07-18 23:47:33 +0000
commit168ba30ce1cad698f2a471e61f34be9df65ff948 (patch)
tree7ee41852986f7615e888536c9117195b90ff5d7b /sys
parentfollow up to 'once rule' expiration (diff)
downloadwireguard-openbsd-168ba30ce1cad698f2a471e61f34be9df65ff948.tar.xz
wireguard-openbsd-168ba30ce1cad698f2a471e61f34be9df65ff948.zip
R.I.P. UVM_WAIT(). Use tsleep_nsec(9) directly.
UVM_WAIT() doesn't provide much of a useful abstraction. All callers tsleep forever and no callers set PCATCH, so only 2 of 4 parameters are actually used. Might as well just use tsleep_nsec(9) directly and make the uvm code a bit less specialized. Suggested by mpi@. ok mpi@ visa@ millert@
Diffstat (limited to 'sys')
-rw-r--r--sys/uvm/uvm.h11
-rw-r--r--sys/uvm/uvm_amap.c4
-rw-r--r--sys/uvm/uvm_aobj.c8
-rw-r--r--sys/uvm/uvm_device.c6
-rw-r--r--sys/uvm/uvm_fault.c4
-rw-r--r--sys/uvm/uvm_km.c4
-rw-r--r--sys/uvm/uvm_vnode.c17
7 files changed, 23 insertions, 31 deletions
diff --git a/sys/uvm/uvm.h b/sys/uvm/uvm.h
index c895eb5ea1d..a2147155523 100644
--- a/sys/uvm/uvm.h
+++ b/sys/uvm/uvm.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: uvm.h,v 1.64 2019/03/01 01:46:18 cheloha Exp $ */
+/* $OpenBSD: uvm.h,v 1.65 2019/07/18 23:47:33 cheloha Exp $ */
/* $NetBSD: uvm.h,v 1.24 2000/11/27 08:40:02 chs Exp $ */
/*
@@ -111,15 +111,6 @@ struct uvm {
extern struct uvm uvm;
/*
- * UVM_WAIT: wait... wrapper around the tsleep() function.
- */
-
-#define UVM_WAIT(event, intr, msg, timo) \
-do { \
- tsleep(event, PVM|(intr ? PCATCH : 0), msg, timo); \
-} while (0)
-
-/*
* UVM_PAGE_OWN: track page ownership (only if UVM_PAGE_TRKOWN)
*/
diff --git a/sys/uvm/uvm_amap.c b/sys/uvm/uvm_amap.c
index b0f9aa85920..b1d567a292b 100644
--- a/sys/uvm/uvm_amap.c
+++ b/sys/uvm/uvm_amap.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: uvm_amap.c,v 1.80 2019/05/15 06:12:19 anton Exp $ */
+/* $OpenBSD: uvm_amap.c,v 1.81 2019/07/18 23:47:33 cheloha Exp $ */
/* $NetBSD: uvm_amap.c,v 1.27 2000/11/25 06:27:59 chs Exp $ */
/*
@@ -683,7 +683,7 @@ ReStart:
*/
if (pg->pg_flags & PG_BUSY) {
atomic_setbits_int(&pg->pg_flags, PG_WANTED);
- UVM_WAIT(pg, FALSE, "cownow", 0);
+ tsleep_nsec(pg, PVM, "cownow", INFSLP);
goto ReStart;
}
diff --git a/sys/uvm/uvm_aobj.c b/sys/uvm/uvm_aobj.c
index 63e6c993fc2..e0f56921fdd 100644
--- a/sys/uvm/uvm_aobj.c
+++ b/sys/uvm/uvm_aobj.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: uvm_aobj.c,v 1.85 2017/01/31 17:08:51 dhill Exp $ */
+/* $OpenBSD: uvm_aobj.c,v 1.86 2019/07/18 23:47:33 cheloha Exp $ */
/* $NetBSD: uvm_aobj.c,v 1.39 2001/02/18 21:19:08 chs Exp $ */
/*
@@ -874,7 +874,7 @@ uao_detach_locked(struct uvm_object *uobj)
if (pg->pg_flags & PG_BUSY) {
atomic_setbits_int(&pg->pg_flags, PG_WANTED);
uvm_unlock_pageq();
- UVM_WAIT(pg, 0, "uao_det", 0);
+ tsleep_nsec(pg, PVM, "uao_det", INFSLP);
uvm_lock_pageq();
continue;
}
@@ -942,7 +942,7 @@ uao_flush(struct uvm_object *uobj, voff_t start, voff_t stop, int flags)
/* Make sure page is unbusy, else wait for it. */
if (pp->pg_flags & PG_BUSY) {
atomic_setbits_int(&pp->pg_flags, PG_WANTED);
- UVM_WAIT(pp, 0, "uaoflsh", 0);
+ tsleep_nsec(pp, PVM, "uaoflsh", INFSLP);
curoff -= PAGE_SIZE;
continue;
}
@@ -1166,7 +1166,7 @@ uao_get(struct uvm_object *uobj, voff_t offset, struct vm_page **pps,
/* page is there, see if we need to wait on it */
if ((ptmp->pg_flags & PG_BUSY) != 0) {
atomic_setbits_int(&ptmp->pg_flags, PG_WANTED);
- UVM_WAIT(ptmp, FALSE, "uao_get", 0);
+ tsleep_nsec(ptmp, PVM, "uao_get", INFSLP);
continue; /* goto top of pps while loop */
}
diff --git a/sys/uvm/uvm_device.c b/sys/uvm/uvm_device.c
index cfd191bd34f..3936cf0f346 100644
--- a/sys/uvm/uvm_device.c
+++ b/sys/uvm/uvm_device.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: uvm_device.c,v 1.55 2018/08/20 10:00:04 kettenis Exp $ */
+/* $OpenBSD: uvm_device.c,v 1.56 2019/07/18 23:47:33 cheloha Exp $ */
/* $NetBSD: uvm_device.c,v 1.30 2000/11/25 06:27:59 chs Exp $ */
/*
@@ -144,8 +144,8 @@ udv_attach(dev_t device, vm_prot_t accessprot, voff_t off, vsize_t size)
*/
if (lcv->u_flags & UVM_DEVICE_HOLD) {
lcv->u_flags |= UVM_DEVICE_WANTED;
- msleep(lcv, &udv_lock, PVM | PNORELOCK,
- "udv_attach", 0);
+ msleep_nsec(lcv, &udv_lock, PVM | PNORELOCK,
+ "udv_attach", INFSLP);
continue;
}
diff --git a/sys/uvm/uvm_fault.c b/sys/uvm/uvm_fault.c
index 087fac7851c..f37418701dc 100644
--- a/sys/uvm/uvm_fault.c
+++ b/sys/uvm/uvm_fault.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: uvm_fault.c,v 1.95 2019/02/03 05:33:48 visa Exp $ */
+/* $OpenBSD: uvm_fault.c,v 1.96 2019/07/18 23:47:33 cheloha Exp $ */
/* $NetBSD: uvm_fault.c,v 1.51 2000/08/06 00:22:53 thorpej Exp $ */
/*
@@ -301,7 +301,7 @@ uvmfault_anonget(struct uvm_faultinfo *ufi, struct vm_amap *amap,
* the owner of page
*/
uvmfault_unlockall(ufi, amap, NULL, NULL);
- UVM_WAIT(pg, 0, "anonget2", 0);
+ tsleep_nsec(pg, PVM, "anonget2", INFSLP);
/* ready to relock and try again */
} else {
/* no page, we must try and bring it in. */
diff --git a/sys/uvm/uvm_km.c b/sys/uvm/uvm_km.c
index f56491be806..17007f46197 100644
--- a/sys/uvm/uvm_km.c
+++ b/sys/uvm/uvm_km.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: uvm_km.c,v 1.131 2019/02/22 07:53:56 tedu Exp $ */
+/* $OpenBSD: uvm_km.c,v 1.132 2019/07/18 23:47:33 cheloha Exp $ */
/* $NetBSD: uvm_km.c,v 1.42 2001/01/14 02:10:01 thorpej Exp $ */
/*
@@ -250,7 +250,7 @@ uvm_km_pgremove(struct uvm_object *uobj, vaddr_t start, vaddr_t end)
pp = uvm_pagelookup(uobj, curoff);
if (pp && pp->pg_flags & PG_BUSY) {
atomic_setbits_int(&pp->pg_flags, PG_WANTED);
- UVM_WAIT(pp, 0, "km_pgrm", 0);
+ tsleep_nsec(pp, PVM, "km_pgrm", INFSLP);
curoff -= PAGE_SIZE; /* loop back to us */
continue;
}
diff --git a/sys/uvm/uvm_vnode.c b/sys/uvm/uvm_vnode.c
index 3803d31db7b..78e972a2b53 100644
--- a/sys/uvm/uvm_vnode.c
+++ b/sys/uvm/uvm_vnode.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: uvm_vnode.c,v 1.103 2018/07/16 16:44:09 helg Exp $ */
+/* $OpenBSD: uvm_vnode.c,v 1.104 2019/07/18 23:47:33 cheloha Exp $ */
/* $NetBSD: uvm_vnode.c,v 1.36 2000/11/24 20:34:01 chs Exp $ */
/*
@@ -147,7 +147,7 @@ uvn_attach(struct vnode *vp, vm_prot_t accessprot)
/* first get a lock on the uvn. */
while (uvn->u_flags & UVM_VNODE_BLOCKED) {
uvn->u_flags |= UVM_VNODE_WANTED;
- UVM_WAIT(uvn, FALSE, "uvn_attach", 0);
+ tsleep_nsec(uvn, PVM, "uvn_attach", INFSLP);
}
/* if we're mapping a BLK device, make sure it is a disk. */
@@ -351,7 +351,7 @@ uvn_detach(struct uvm_object *uobj)
/* wait on any outstanding io */
while (uobj->uo_npages && uvn->u_flags & UVM_VNODE_RELKILL) {
uvn->u_flags |= UVM_VNODE_IOSYNC;
- UVM_WAIT(&uvn->u_nio, FALSE, "uvn_term", 0);
+ tsleep_nsec(&uvn->u_nio, PVM, "uvn_term", INFSLP);
}
if ((uvn->u_flags & UVM_VNODE_RELKILL) == 0)
@@ -477,7 +477,7 @@ uvm_vnp_terminate(struct vnode *vp)
*/
#endif
uvn->u_flags |= UVM_VNODE_IOSYNC;
- UVM_WAIT(&uvn->u_nio, FALSE, "uvn_term", 0);
+ tsleep_nsec(&uvn->u_nio, PVM, "uvn_term", INFSLP);
}
/*
@@ -667,7 +667,8 @@ uvn_flush(struct uvm_object *uobj, voff_t start, voff_t stop, int flags)
atomic_setbits_int(&pp->pg_flags,
PG_WANTED);
uvm_unlock_pageq();
- UVM_WAIT(pp, 0, "uvn_flsh", 0);
+ tsleep_nsec(pp, PVM, "uvn_flsh",
+ INFSLP);
uvm_lock_pageq();
curoff -= PAGE_SIZE;
continue;
@@ -815,7 +816,7 @@ ReTry:
if (need_iosync) {
while (uvn->u_nio != 0) {
uvn->u_flags |= UVM_VNODE_IOSYNC;
- UVM_WAIT(&uvn->u_nio, FALSE, "uvn_flush", 0);
+ tsleep_nsec(&uvn->u_nio, PVM, "uvn_flush", INFSLP);
}
if (uvn->u_flags & UVM_VNODE_IOSYNCWANTED)
wakeup(&uvn->u_flags);
@@ -1018,7 +1019,7 @@ uvn_get(struct uvm_object *uobj, voff_t offset, struct vm_page **pps,
/* page is there, see if we need to wait on it */
if ((ptmp->pg_flags & PG_BUSY) != 0) {
atomic_setbits_int(&ptmp->pg_flags, PG_WANTED);
- UVM_WAIT(ptmp, FALSE, "uvn_get", 0);
+ tsleep_nsec(ptmp, PVM, "uvn_get", INFSLP);
continue; /* goto top of pps while loop */
}
@@ -1118,7 +1119,7 @@ uvn_io(struct uvm_vnode *uvn, vm_page_t *pps, int npages, int flags, int rw)
return(VM_PAGER_AGAIN);
}
uvn->u_flags |= UVM_VNODE_IOSYNCWANTED;
- UVM_WAIT(&uvn->u_flags, FALSE, "uvn_iosync", 0);
+ tsleep_nsec(&uvn->u_flags, PVM, "uvn_iosync", INFSLP);
}
/* check size */