diff options
author | Alexander Motin <mav@FreeBSD.org> | 2021-10-03 00:57:55 +0000 |
---|---|---|
committer | Alexander Motin <mav@FreeBSD.org> | 2021-10-03 01:08:41 +0000 |
commit | 6df1359e5542f69179c142be1ea099d447e273d1 (patch) | |
tree | 0b1165ab1c1ec88dc732991782e63a89d03e825d | |
parent | 9acea16404117f2f54475640ff036c12130707d8 (diff) | |
download | src-6df1359e5542f69179c142be1ea099d447e273d1.tar.gz src-6df1359e5542f69179c142be1ea099d447e273d1.zip |
sleepqueue(9): Remove sbinuptime() from sleepq_timeout().
Callout c_time is always bigger or equal than the scheduled time. It
is also smaller than sbinuptime() and can't change while the callback
is running. So we reliably can use it instead of sbinuptime() here.
In case there was a race and the callout was rescheduled to the later
time, the callback will be called again.
According to profiles it saves ~5% of the timer interrupt time even
with fast TSC timecounter.
MFC after: 1 month
-rw-r--r-- | sys/kern/subr_sleepqueue.c | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/sys/kern/subr_sleepqueue.c b/sys/kern/subr_sleepqueue.c index b146a978a60c..61efb1b9f377 100644 --- a/sys/kern/subr_sleepqueue.c +++ b/sys/kern/subr_sleepqueue.c @@ -1040,7 +1040,8 @@ sleepq_timeout(void *arg) (void *)td, (long)td->td_proc->p_pid, (void *)td->td_name); thread_lock(td); - if (td->td_sleeptimo == 0 || td->td_sleeptimo > sbinuptime()) { + if (td->td_sleeptimo == 0 || + td->td_sleeptimo > td->td_slpcallout.c_time) { /* * The thread does not want a timeout (yet). */ |