From nobody Tue Nov 2 00:24:47 2021 X-Original-To: dev-commits-src-branches@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id D308D182BB21; Tue, 2 Nov 2021 00:24:47 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4HjrJH5QNtz4ckD; Tue, 2 Nov 2021 00:24:47 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 95BAF1B24D; Tue, 2 Nov 2021 00:24:47 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 1A20Olhi011758; Tue, 2 Nov 2021 00:24:47 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 1A20OlxE011757; Tue, 2 Nov 2021 00:24:47 GMT (envelope-from git) Date: Tue, 2 Nov 2021 00:24:47 GMT Message-Id: <202111020024.1A20OlxE011757@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Alexander Motin Subject: git: aac9d07f9314 - stable/13 - sleepqueue(9): Remove sbinuptime() from sleepq_timeout(). List-Id: Commits to the stable branches of the FreeBSD src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-branches List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-branches@freebsd.org X-BeenThere: dev-commits-src-branches@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: mav X-Git-Repository: src X-Git-Refname: refs/heads/stable/13 X-Git-Reftype: branch X-Git-Commit: aac9d07f9314d518996b63427b223be455869333 Auto-Submitted: auto-generated X-ThisMailContainsUnwantedMimeParts: N The branch stable/13 has been updated by mav: URL: https://cgit.FreeBSD.org/src/commit/?id=aac9d07f9314d518996b63427b223be455869333 commit aac9d07f9314d518996b63427b223be455869333 Author: Alexander Motin AuthorDate: 2021-10-03 00:57:55 +0000 Commit: Alexander Motin 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). */