summaryrefslogtreecommitdiff
path: root/sys/uvm/uvm_pmemrange.c
diff options
context:
space:
mode:
authorcheloha <cheloha@cvs.openbsd.org>2019-07-03 22:39:34 +0000
committercheloha <cheloha@cvs.openbsd.org>2019-07-03 22:39:34 +0000
commit40d389b2bd19834e09052025f12e67335b94fc98 (patch)
tree3f5428eadae30d9344b2407c5295b0dced7579f5 /sys/uvm/uvm_pmemrange.c
parentd5cb3b4efc31fe576d9835223fa53e89d6671346 (diff)
Add tsleep_nsec(9), msleep_nsec(9), and rwsleep_nsec(9).
Equivalent to their unsuffixed counterparts except that (a) they take a timeout in terms of nanoseconds, and (b) INFSLP, aka UINT64_MAX (not zero) indicates that a timeout should not be set. For now, zero nanoseconds is not a strictly valid invocation: we log a warning on DIAGNOSTIC kernels if we see such a call. We still sleep until the next tick in such a case, however. In the future this could become some sort of poll... TBD. To facilitate conversions to these interfaces: add inline conversion functions to sys/time.h for turning your timeout into nanoseconds. Also do a few easy conversions for warmup and to demonstrate how further conversions should be done. Lots of input from mpi@ and ratchov@. Additional input from tedu@, deraadt@, mortimer@, millert@, and claudio@. Partly inspired by FreeBSD r247787. positive feedback from deraadt@, ok mpi@
Diffstat (limited to 'sys/uvm/uvm_pmemrange.c')
-rw-r--r--sys/uvm/uvm_pmemrange.c5
1 files changed, 3 insertions, 2 deletions
diff --git a/sys/uvm/uvm_pmemrange.c b/sys/uvm/uvm_pmemrange.c
index cd92c319650..7d9e2a52b67 100644
--- a/sys/uvm/uvm_pmemrange.c
+++ b/sys/uvm/uvm_pmemrange.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: uvm_pmemrange.c,v 1.54 2019/05/09 20:36:44 beck Exp $ */
+/* $OpenBSD: uvm_pmemrange.c,v 1.55 2019/07/03 22:39:33 cheloha Exp $ */
/*
* Copyright (c) 2009, 2010 Ariane van der Steldt <ariane@stack.nl>
@@ -1928,7 +1928,8 @@ uvm_wait_pla(paddr_t low, paddr_t high, paddr_t size, int failok)
* uvm_wait(), as this is exactly the same issue.
*/
printf("pagedaemon: wait_pla deadlock detected!\n");
- msleep(&uvmexp.free, &uvm.fpageqlock, PVM, wmsg, hz >> 3);
+ msleep_nsec(&uvmexp.free, &uvm.fpageqlock, PVM, wmsg,
+ MSEC_TO_NSEC(125));
#if defined(DEBUG)
/* DEBUG: panic so we can debug it */
panic("wait_pla pagedaemon deadlock");