From nobody Thu May 09 13:30:21 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 4VZtDZ1b87z5Jgvg; Thu, 09 May 2024 13:30:22 +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 4VZtDY6yXMz3y1R; Thu, 9 May 2024 13:30:21 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1715261422; 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=+P3z+L/3PyBC9IIODoOw6cNlJgC1GSqEIFAgg2RB7iE=; b=f+dzLm6y/i4s2wTtNw4ixRv1rwRsJ2k3rzYDihuv6V+KTQemHcv3wqZ7sYWH5dFJrIheWK GDEm3IA3juadtcY9I2Rv0fT2k+qah5FWVZqkJ+f8ExuMzxsRA6VUCVaWZflzcyncvI4Z1J wBNpmJXlj8xRrXawsP5hamKRksH+95KgD2ddfkwWI36cFv+BV7GiUzOv3XuGYhgQjVx8ZQ ZzZdkcyKttzB/y6xAjRJbFWzCXeBs0pB2lalVuS/Q2kG5eCjKkYQmmyWoPRQIJgUFDovsk jTQz760pqPa21x+eS2HHDc/hLbZAerZA0QEFrOn1FCmwsDeW6P/AhzVRRCesgw== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1715261422; a=rsa-sha256; cv=none; b=iPjBbvbhNBB36s8niPYGub0332SJ4Uevu8TxtkCDJsXYro5Qu7MRXppCJWl3mVs552rQGx tMy0y44XEElwkJMAtzoMjNBdEZgAn61B8+UuH19Aflp6uJ2+TtPxHpflBM7H9bk/KHopsi 9Vz53jjXC8E5uumh2hz6kl6CAEEezqnSPkFOGtB/w+SQYTWA+jyI87lq8bCQ3y96ickXL8 m1nlYDy7Fg5FuDa0chb4AxD0yi8aZuhgYGeALvZdLsUBQmZBnGKiaCeOJbpmv2TWKjUM6L QN1bQeu6V1gyjzdqJKAXkhStBnBbFaFq2CkUgMmBnp4uBlAP5VNLPyFivDgIFQ== 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=1715261422; 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=+P3z+L/3PyBC9IIODoOw6cNlJgC1GSqEIFAgg2RB7iE=; b=GtMPtP9umFV50nRn8XCzLeoVd4IdINtYdBdTeDJ8GLUnoNh0YZ7p4qpV0UipcB3et361N5 nNy5xetQ+AcUPySSSPYgiBU4S+VWGk4wesinbkt5B9C3h8F1iUjeODur7ZoOLdcKp7KimJ y7egqoBGk6M1ThAUtHL6NopH1e9SwGCkok54WRYYwwSP2Uxb9uEMQXOe6y2qb56GIOq9C+ uMHzUz/mqG4peasMuEcuF8XIufI9AgCO6UG1hV5rFIpsR1Z0udeY6J0o15sk4YimjomI9P YCcUUwiF8BXZ9B/QGOM6BF3Vop2uOPqORlm9LtkFSEYG1Mh73xizvUJtWdEeWg== 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 4VZtDY6J4pz19dR; Thu, 9 May 2024 13:30:21 +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 449DULTN058996; Thu, 9 May 2024 13:30:21 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.17.1/8.17.1/Submit) id 449DULdK058993; Thu, 9 May 2024 13:30:21 GMT (envelope-from git) Date: Thu, 9 May 2024 13:30:21 GMT Message-Id: <202405091330.449DULdK058993@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: 8c308a22e759 - stable/13 - 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/13 X-Git-Reftype: branch X-Git-Commit: 8c308a22e759a666704f2b6d730568a83fb271b1 Auto-Submitted: auto-generated The branch stable/13 has been updated by olce: URL: https://cgit.FreeBSD.org/src/commit/?id=8c308a22e759a666704f2b6d730568a83fb271b1 commit 8c308a22e759a666704f2b6d730568a83fb271b1 Author: Olivier Certner AuthorDate: 2024-02-09 18:03:22 +0000 Commit: Olivier Certner CommitDate: 2024-05-09 13:29:32 +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 700f0dca93aa..ca615098c1df 100644 --- a/sys/kern/sched_4bsd.c +++ b/sys/kern/sched_4bsd.c @@ -953,15 +953,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 9220b4700af7..b53c2f57c908 100644 --- a/sys/kern/sched_ule.c +++ b/sys/kern/sched_ule.c @@ -1996,15 +1996,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);