From nobody Thu May 09 13:27:00 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 4VZt8j0WTFz5JgsQ; Thu, 09 May 2024 13:27:01 +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 4VZt8h5rzTz3x9C; Thu, 9 May 2024 13:27:00 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1715261220; 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=qawd7jYkIH2UHaE0LUC3/pgg5wvNvhiqKD6bm/4W88s=; b=U2hMQIr8VqFyeB8jurFZbql2uFEBz2EZ+VqSGPsqAXwDxYtY/XOV9qWBoKfTXZUNZe0vQf hXrGkjU/yXj7aga9Qavp6i6usfQ9io4z7HyFFC7pJpnCHI1pw0hTePKRzHzRd4en76CEYh x1GhjClRofJaFbWXAi9aEEN9BvFiVeSF5UUcXILZEPuSM25E9cen2e+KOTtONPZd6I7Uxf 2EHmS4SQaVnJXJyp0Nuatsv457d8fqZegO3WGjtSDrqNPs/WLqUNYXudkAuFFWbdmWMqaX sFVnhVGF2lMEPCyK1VqQ2QHBk97SJRK7BjtN9S0LsCXMWIufKIKPCAsUEfix/w== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1715261220; a=rsa-sha256; cv=none; b=mcaHISQw2fb/LrYJAtQeI2b/gvI9nrOsNgeq0pVizQZaQtvZfAmjPE7O0xC9UlnAzUd0Dl fvj9nbcYqC59jxFl2ID8erRNhAvpmb0GK/pUQkxhPvSJcAzPT5LT1dlWAO+n4TP6SmXUWw Opzjv1gW7sO0x5G0XsGwDXpRMgm+sPqwBSVf5NCGJGwmRgise3zt1kIkZIe04t4akmOsyQ johCQDyZknes/cGra4IoMqrlfAzHHJWARbyTdGqY40zI86dhqGVyyEx7Cc1Ge4AA2MmTJZ /0HmZ/AiSbsOf7MaCu0bSoPKuyy28fcyIDRjKeGwYtD5Vuk5QQYTX0eJJ5rv0w== 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=1715261220; 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=qawd7jYkIH2UHaE0LUC3/pgg5wvNvhiqKD6bm/4W88s=; b=MJn1xcSKdMfxKi5ZJCHNbLDgO2dWbtP+jKIMR9j6uxdRBUXC2CoZ63BeZmPD9FsCjPIdDi RcnKwywCI+PntEDKJmQHIm1Rn6pMRkwIkEBcBx6VVbHIbfe0n2/mCfSM3nPiloQP+tjpQr Y/6qB+pqwd9IIn5F073wemnQ/Xt74nB5MhOpdPywBRgEH6LdFjajgKxw5gFvJyueCKGtTX Tl4ce5IqE8lxXTxkJLVY5HtPywuZvV0x/6Fhx30/1YYOnPVdRz1D/y7N04jWD6dIdcFWbv 94GQ4XgOqlzvYfrZ8pi62av4Y+I1IOQA9k9TzknGqkU21x28HETjIVDCJscGuA== 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 4VZt8h5QpQz19BS; Thu, 9 May 2024 13:27:00 +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 449DR0Zh049717; Thu, 9 May 2024 13:27:00 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.17.1/8.17.1/Submit) id 449DR0Fh049714; Thu, 9 May 2024 13:27:00 GMT (envelope-from git) Date: Thu, 9 May 2024 13:27:00 GMT Message-Id: <202405091327.449DR0Fh049714@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: b8b729e23cb9 - stable/14 - 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/stable/14 X-Git-Reftype: branch X-Git-Commit: b8b729e23cb91a77f3ca51df5100e2c85dfa7447 Auto-Submitted: auto-generated The branch stable/14 has been updated by olce: URL: https://cgit.FreeBSD.org/src/commit/?id=b8b729e23cb91a77f3ca51df5100e2c85dfa7447 commit b8b729e23cb91a77f3ca51df5100e2c85dfa7447 Author: Olivier Certner AuthorDate: 2024-02-09 18:03:22 +0000 Commit: Olivier Certner CommitDate: 2024-05-09 13:26:21 +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) --- 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);