From nobody Tue Feb 27 09:00:19 2024 X-Original-To: dev-commits-src-main@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 4TkWfC6gnLz5Cms9; Tue, 27 Feb 2024 09:00:19 +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 4TkWfC5LxCz4h74; Tue, 27 Feb 2024 09:00:19 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1709024419; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=/KWdYOV1RlCeqV2mRRuwrobnx8GSXFVXynEvRmPEVpI=; b=CVp+jA/WMeE0ZS52Js6uFaf9Jz9Yp+Uqcrdiiedwsz9Nwxhb+alnxZAhNBNMz9nglQ2knO PSiLAAIXZPT9g0ixibvn4ZMfnPDLE+w49/JCu4zuD7IGdhwvoycDFau9sYchZiHMmtk+wK 42/dTbR0Bub6UJPOAxfgSuatuU2mUfZXLTuzYoNdPaShd8MX2Kqtv4w/GQNFeUZbFPBnyU 87jYssoNCoBlGiOQJZYZiPgp31NtnVKphocmQWDNbWc0yjK0BiIAD5x5Anh/EELa+bx1zW z/JymaX7kYpRmBF7oo2RRMtUKzvdr3593D4GwhYNz84QKhUWdwFzB0obRXaUqg== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1709024419; a=rsa-sha256; cv=none; b=OhoSf+7paIOvbMIt3rVfdhWEMhqDlzH42KycWIZfnJhc3zzTBU/4ZpXA5yiywOD8I4oYMj o4ZZligqXwC2ch0rvM/f3Jk0SEnLfSD/ciZipoDYkG0GhfuZzG2aG/WrYRHMvFKkZVge8d cW7O3b3JYWZK4wLkbT32tuG7gIcUMaclFS7obVjt4oktGJ3DuFmrTwRiSP49d4dbTI7/8d KHmNLC8mu6+L/B60QgT5MfFZgfnUeLzixpT24gHLR2ybrK1X977+qgt8r+ry87250NsQ8e DDRHULG0IWP+vY2uyfeFZ5Te59hMsGiunNUA06k27YPRhFVhLjUX/Ozn277zkg== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1709024419; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=/KWdYOV1RlCeqV2mRRuwrobnx8GSXFVXynEvRmPEVpI=; b=F5BHAUcApRjIHaEfeAkA/3l5QBcAXIuUeO51WuBEzixxDdCIyg0SpqYwK0CKqlYb1weIW7 C+0MK1ALJAgPk7QMIo+xZg4mp79k3rFnvCojb0JGus0Qfb7UiGBPPfO8mC/60vUvqJ/SVa 4HJWyVTw/IGGIHmlsQw1NJHa+X3G1DPh1Uq3s+CFZtgkQv76U6rCMVD6Dc7npthBU3wz66 6jfgun6Xk/1ePPWKS3D/IfCVlmWg7q03qZR3KecDHCCg25Uk/1H59gy0gFXBMaDqL70RCG yV9x9Ll7PwS20amUWNnz/LQP8lovZa3j08cLGHwMzgTbJ1Y62s3XgHkSeiHlkg== 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 4TkWfC4RnGz15Th; Tue, 27 Feb 2024 09:00:19 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.17.1/8.17.1) with ESMTP id 41R90JJK004691; Tue, 27 Feb 2024 09:00:19 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.17.1/8.17.1/Submit) id 41R90J0H004688; Tue, 27 Feb 2024 09:00:19 GMT (envelope-from git) Date: Tue, 27 Feb 2024 09:00:19 GMT Message-Id: <202402270900.41R90J0H004688@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Olivier Certner Subject: git: aeff15b392e6 - main - sched: Simplify sched_lend_user_prio_cond() List-Id: Commit messages for the main branch of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-main List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-main@freebsd.org X-BeenThere: dev-commits-src-main@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: olce X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: aeff15b392e68f5f193fff3bb01728b965cacc3a Auto-Submitted: auto-generated The branch main has been updated by olce: URL: https://cgit.FreeBSD.org/src/commit/?id=aeff15b392e68f5f193fff3bb01728b965cacc3a commit aeff15b392e68f5f193fff3bb01728b965cacc3a Author: Olivier Certner AuthorDate: 2024-02-09 18:03:22 +0000 Commit: Olivier Certner CommitDate: 2024-02-27 08:59:48 +0000 sched: Simplify sched_lend_user_prio_cond() If 'td_lend_user_pri' has the expected value, there is no need to check the fields that sched_lend_user_prio() modifies, they either are already good or soon will be ('td->td_lend_user_pri' has just been changed by a concurrent update). Reviewed by: kib Approved by: emaste (mentor) MFC after: 2 weeks Sponsored by: The FreeBSD Foundation Differential Revision: https://reviews.freebsd.org/D44050 --- sys/kern/sched_4bsd.c | 12 +++--------- sys/kern/sched_ule.c | 10 ++-------- 2 files changed, 5 insertions(+), 17 deletions(-) diff --git a/sys/kern/sched_4bsd.c b/sys/kern/sched_4bsd.c index f0fffeb08e2d..ff1e57746404 100644 --- a/sys/kern/sched_4bsd.c +++ b/sys/kern/sched_4bsd.c @@ -981,15 +981,9 @@ void sched_lend_user_prio_cond(struct thread *td, u_char prio) { - if (td->td_lend_user_pri != prio) - goto lend; - if (td->td_user_pri != min(prio, td->td_base_user_pri)) - goto lend; - if (td->td_priority != td->td_user_pri) - goto lend; - return; - -lend: + if (td->td_lend_user_pri == prio) + return; + thread_lock(td); sched_lend_user_prio(td, prio); thread_unlock(td); diff --git a/sys/kern/sched_ule.c b/sys/kern/sched_ule.c index c0d085fcf906..502802047cd4 100644 --- a/sys/kern/sched_ule.c +++ b/sys/kern/sched_ule.c @@ -2007,15 +2007,9 @@ void sched_lend_user_prio_cond(struct thread *td, u_char prio) { - if (td->td_lend_user_pri != prio) - goto lend; - if (td->td_user_pri != min(prio, td->td_base_user_pri)) - goto lend; - if (td->td_priority != td->td_user_pri) - goto lend; - return; + if (td->td_lend_user_pri == prio) + return; -lend: thread_lock(td); sched_lend_user_prio(td, prio); thread_unlock(td);