Skip site navigation (1)Skip section navigation (2)
Date:      Sun, 3 Oct 2021 01:08:46 GMT
From:      Alexander Motin <mav@FreeBSD.org>
To:        src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org
Subject:   git: 6df1359e5542 - main - sleepqueue(9): Remove sbinuptime() from sleepq_timeout().
Message-ID:  <202110030108.19318kxT074027@gitrepo.freebsd.org>

next in thread | raw e-mail | index | archive | help
The branch main has been updated by mav:

URL: https://cgit.FreeBSD.org/src/commit/?id=6df1359e5542f69179c142be1ea099d447e273d1

commit 6df1359e5542f69179c142be1ea099d447e273d1
Author:     Alexander Motin <mav@FreeBSD.org>
AuthorDate: 2021-10-03 00:57:55 +0000
Commit:     Alexander Motin <mav@FreeBSD.org>
CommitDate: 2021-10-03 01:08:41 +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
---
 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 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).
 		 */



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?202110030108.19318kxT074027>