git: aac9d07f9314 - stable/13 - sleepqueue(9): Remove sbinuptime() from sleepq_timeout().
- Go to: [ bottom of page ] [ top of archives ] [ this month ]
Date: Tue, 02 Nov 2021 00:24:47 UTC
The branch stable/13 has been updated by mav: URL: https://cgit.FreeBSD.org/src/commit/?id=aac9d07f9314d518996b63427b223be455869333 commit aac9d07f9314d518996b63427b223be455869333 Author: Alexander Motin <mav@FreeBSD.org> AuthorDate: 2021-10-03 00:57:55 +0000 Commit: Alexander Motin <mav@FreeBSD.org> CommitDate: 2021-11-02 00:24:07 +0000 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 (cherry picked from commit 6df1359e5542f69179c142be1ea099d447e273d1) --- sys/kern/subr_sleepqueue.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/sys/kern/subr_sleepqueue.c b/sys/kern/subr_sleepqueue.c index 73aef9890647..36832ef96ba4 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). */