From nobody Tue May 14 13:39:26 2024 X-Original-To: dev-commits-src-all@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 4VdyBl1ntFz5K7BG; Tue, 14 May 2024 13:39:27 +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 4VdyBl1BW2z4PQ5; Tue, 14 May 2024 13:39:27 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1715693967; 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=O8Zzv4BE5RnR3jXUIo7DwZic/SIt8T4SUQcCPrfqx8I=; b=IA1qZPqVuItbJ+RodWKj3rMkiIKf+tzCOoPQ+ClNS3yEHJvpActPPOnepAwlWHHdKrmCyY ZQFEnfSTTp2+EDCnL6m53EjXE8mlpXv8+6IxQXANRorg6VI0eLXuqK6T3mu4fmQoFoZdq5 9vFoKN3vvIqBMH8Ooy70Un5cH9V1KXw/6qf6D6Vg4ojTUIcLB1M4Vrn5WRCb02EllrD1lK PrGY7JBfguI0g04ixdQx89G2ZRhe19tDIw3d0dsqGdC71/VE9IwHAKNSIpUEcoSYypMpIR tkypp4MG+qTRwCSWEdkgxO3deAB8t9sMs22GencHnzZP6J01MnRlcVLRBQgfmA== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1715693967; a=rsa-sha256; cv=none; b=oh3nfB6cVaPwW5NHLxcD1O7ZspN78Mr9XREVp+JZe92iCRyJ/Rl2Dx5piAobaZh9qKd85B 1+GrzwGU8Psogmh+/b3NSr86fHHDWnJEnV80rNCZlSiJsptCTDbY+9ZAEVpAMhLpmhwUVJ iuhHFK5+D9tXfa6iNK2PCTE3cG8JwbcMKMHcleDmoQc0/HkFYCQB1vX+GnJ3Y/8VpcYr42 aVY3rM75sixpVPBUnHVrbDVGjxAMzZ3JQxqWgUp4XOQ1NxuvoQBkhdkXpFAgqltuKqN5Tk XzOkwUqdPDMabzqcz+BVBVQs8hRxwdmEuUZploK59/5jAbTOu4x2A2HciY2eEA== 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=1715693967; 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=O8Zzv4BE5RnR3jXUIo7DwZic/SIt8T4SUQcCPrfqx8I=; b=XY6OEF4F1Ct65PJsRd1DLiDOecZyaHFbUcZ4pHw3TDUdos6d5TtYrWmYkfiPaI7voZnrFe FtPVD5OiZqzAGK0FpkqiV6XaTy1cCn1OQV3DplIWAgPw/0ls52UC6H5TMEy+rh8oqPRAaX B9GQBgY8mZkOyN1yb49EJUHiQA9cAeeZgTB35YK4NbJbGHhTNlW730Ljmq4Sku1AnbUXs5 n7p57V6/vhEKHGQ4U2b7vDEuzSS/6hbEqSyajkES95akUAz+ovGRX6pfaI3wV7GgNukyBr wCNWq3VItp310g+RzCOPzOTktD6aZdQXeOFkxG0lNCzOpVMn1yrCBWEyzi+STg== 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 4VdyBl0X3YzYZt; Tue, 14 May 2024 13:39:27 +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 44EDdQLf080545; Tue, 14 May 2024 13:39:26 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.17.1/8.17.1/Submit) id 44EDdQKj080542; Tue, 14 May 2024 13:39:26 GMT (envelope-from git) Date: Tue, 14 May 2024 13:39:26 GMT Message-Id: <202405141339.44EDdQKj080542@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Olivier Certner Subject: git: 81ddf56306ca - releng/14.1 - sched: Simplify sched_lend_user_prio_cond() List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: X-BeenThere: dev-commits-src-all@freebsd.org Sender: owner-dev-commits-src-all@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/releng/14.1 X-Git-Reftype: branch X-Git-Commit: 81ddf56306ca46894baa376c4f58c4a52ce5809d Auto-Submitted: auto-generated The branch releng/14.1 has been updated by olce: URL: https://cgit.FreeBSD.org/src/commit/?id=81ddf56306ca46894baa376c4f58c4a52ce5809d commit 81ddf56306ca46894baa376c4f58c4a52ce5809d Author: Olivier Certner AuthorDate: 2024-02-09 18:03:22 +0000 Commit: Olivier Certner CommitDate: 2024-05-14 13:37:42 +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 (cherry picked from commit aeff15b392e68f5f193fff3bb01728b965cacc3a) Approved by: emaste (mentor) (cherry picked from commit b8b729e23cb91a77f3ca51df5100e2c85dfa7447) Approved by: emaste (mentor) Approved by: re (cperciva) --- 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 ee1e0ab0b955..4b99f1c486bf 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);