diff options
author | 2019-09-20 16:44:32 +0000 | |
---|---|---|
committer | 2019-09-20 16:44:32 +0000 | |
commit | 4d87f6434977fc1415872eef80e55239d6a6f7e5 (patch) | |
tree | b6f004f21c0f648ef0a44c063898468a0a144b76 | |
parent | Print inquiry and read capacity (10 and 16) data under SCSIDEBUG. (diff) | |
download | wireguard-openbsd-4d87f6434977fc1415872eef80e55239d6a6f7e5.tar.xz wireguard-openbsd-4d87f6434977fc1415872eef80e55239d6a6f7e5.zip |
timeout(9): process-context timeouts can be late
Move the check for lateness earlier in the softclock() loop so every
timeout is checked before being run.
While here, remove an unsafe DEBUG printf(9). You can't safely printf(9)
within a mutex, and the print itself isn't even particularly useful.
ok bluhm@
-rw-r--r-- | sys/kern/kern_timeout.c | 20 |
1 files changed, 9 insertions, 11 deletions
diff --git a/sys/kern/kern_timeout.c b/sys/kern/kern_timeout.c index 0dd5a46a4d9..84e1cb8c9c8 100644 --- a/sys/kern/kern_timeout.c +++ b/sys/kern/kern_timeout.c @@ -1,4 +1,4 @@ -/* $OpenBSD: kern_timeout.c,v 1.58 2019/09/20 02:59:18 cheloha Exp $ */ +/* $OpenBSD: kern_timeout.c,v 1.59 2019/09/20 16:44:32 cheloha Exp $ */ /* * Copyright (c) 2001 Thomas Nordin <nordin@openbsd.org> * Copyright (c) 2000-2001 Artur Grabowski <art@openbsd.org> @@ -497,19 +497,17 @@ softclock(void *arg) bucket = &BUCKET(delta, to->to_time); CIRCQ_INSERT(&to->to_list, bucket); tostat.tos_rescheduled++; - } else if (ISSET(to->to_flags, TIMEOUT_NEEDPROCCTX)) { + continue; + } + if (delta < 0) + tostat.tos_late++; + if (ISSET(to->to_flags, TIMEOUT_NEEDPROCCTX)) { CIRCQ_INSERT(&to->to_list, &timeout_proc); needsproc = 1; - } else { - if (delta < 0) { - tostat.tos_late++; -#ifdef DEBUG - printf("timeout delayed %d\n", delta); -#endif - } - timeout_run(to); - tostat.tos_run_softclock++; + continue; } + timeout_run(to); + tostat.tos_run_softclock++; } tostat.tos_softclocks++; mtx_leave(&timeout_mutex); |