From nobody Mon Feb 19 16:42:12 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 4TdpGs2Dl2z5C8Yj; Mon, 19 Feb 2024 16:42:13 +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 4TdpGs1Lc3z4YSk; Mon, 19 Feb 2024 16:42:13 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1708360933; 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=oEsysHNBXcbJajlufUFuWN835qolhbvFeRT3gA1mL4c=; b=MIYErKN1Ez/9ozUjzlaxMsPp5q7EHY6ASFWLMi4hbweXshvNHeZFgjZ9oYKufchDFQRXC9 aHKrKRroH8mm49TaG2/tgk6eT65sqVZhwRknN0C85hU1kVdxKCLx5SLbfFXEvn8iBN6OJR Z+58dJl5dfFlT9tjXYM+ngV/qgxLFzBDsiJlFBUcT9GPqTWFIVZkMwi6sLwOAVHbDHe/D2 TCNV3Np52GKQwCLN7Pe7HKhv8zEVf6jjAMhUHImZ1TeTsBJ75D36hLPzppr1p6Wlazo8yG mcDqGcdzzI0zTeTk8/WVPH3r7SO1NQd+TfXay4HIzAQNgJJucdr5TCuSjoP92g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1708360933; 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=oEsysHNBXcbJajlufUFuWN835qolhbvFeRT3gA1mL4c=; b=Gu4coI8NAcIZi6eZMJd15g8GIyIYEtnQOElHN/rpMTjT90CJqDNPHufI6ViZEvHDYQp5nR vXg2W5EqV024dM0lQsrqmPCPsGQikrRHa4eSevFLGMDI/Z6nAWCKaW1+NZknjhL9XKgmXY zQGOwAuRS89VNmwYoewRmg/Mjut7QD5e5D1vbMiBDFeoclbVUUW0eSVqsAws/ywyj6aL+f S4a927QsBgvq7tXQB/AISi89t5Be/NS/OWfGq22b89Ljj3OFuguWNYjjadLGUTW0rMMeJD qfnYkRrrz2iAhHdl8vhXBhxbt6y/wQOs+8V756IYWudqf4X1iO6eVcVE6F6Urg== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1708360933; a=rsa-sha256; cv=none; b=ZYLpYvfXu6v7jXrCwT1lBbgviT9+6fCssWRkwDutZAeJoVKyeE4ZJve5e+of8hMBCXfgir d5G+METWXlFhevv9DGam7gVGjAgkYOQaPeS4EZr/fZ2pxVfmsmii3W1P87CCuHXUOVm55K yRV0XA0R6CC7V7TSvm6PRGXRW5JrwABPVX9d65+03Bqr1QfsYd+YtbV565CBakqFj+b2uR n8DRlD4zDVqQBbIWvIZviQxmD+QPoPNKi06+DNTroccP1X96kPOpCGghM9t3Jaz6S8VeDV tmx8ucWv6KW6+8BUE+tYYtVVdYb3ZCa6UQYg6b7pmo2YlBFEzliiCzwSoLOHAQ== 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 4TdpGs0QgZzjGX; Mon, 19 Feb 2024 16:42:13 +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 41JGgCme093159; Mon, 19 Feb 2024 16:42:12 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.17.1/8.17.1/Submit) id 41JGgCta093156; Mon, 19 Feb 2024 16:42:12 GMT (envelope-from git) Date: Mon, 19 Feb 2024 16:42:12 GMT Message-Id: <202402191642.41JGgCta093156@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: 6a3c02bc5289 - main - sched: sched_switch(): Factorize sleepqueue flags 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: Sender: owner-dev-commits-src-all@freebsd.org X-BeenThere: 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/main X-Git-Reftype: branch X-Git-Commit: 6a3c02bc52892eb09c3b766562b8ddb452c393a9 Auto-Submitted: auto-generated The branch main has been updated by olce: URL: https://cgit.FreeBSD.org/src/commit/?id=6a3c02bc52892eb09c3b766562b8ddb452c393a9 commit 6a3c02bc52892eb09c3b766562b8ddb452c393a9 Author: Olivier Certner AuthorDate: 2024-01-16 09:42:11 +0000 Commit: Olivier Certner CommitDate: 2024-02-19 16:37:19 +0000 sched: sched_switch(): Factorize sleepqueue flags Avoid duplicating common flags for the preempted and non-preempted cases, making it clear that they are the same without resorting to formatting. No functional change. Approved by: markj (mentor) MFC after: 3 days Sponsored by: The FreeBSD Foundation --- sys/kern/sched_4bsd.c | 5 ++--- sys/kern/sched_ule.c | 5 ++--- 2 files changed, 4 insertions(+), 6 deletions(-) diff --git a/sys/kern/sched_4bsd.c b/sys/kern/sched_4bsd.c index efcd9b7cb250..f0fffeb08e2d 100644 --- a/sys/kern/sched_4bsd.c +++ b/sys/kern/sched_4bsd.c @@ -1041,9 +1041,8 @@ sched_switch(struct thread *td, int flags) } else { if (TD_IS_RUNNING(td)) { /* Put us back on the run queue. */ - sched_add(td, preempted ? - SRQ_HOLDTD|SRQ_OURSELF|SRQ_YIELDING|SRQ_PREEMPTED : - SRQ_HOLDTD|SRQ_OURSELF|SRQ_YIELDING); + sched_add(td, SRQ_HOLDTD | SRQ_OURSELF | SRQ_YIELDING | + (preempted ? SRQ_PREEMPTED : 0)); } } diff --git a/sys/kern/sched_ule.c b/sys/kern/sched_ule.c index ebd7139fa612..c0d085fcf906 100644 --- a/sys/kern/sched_ule.c +++ b/sys/kern/sched_ule.c @@ -2227,9 +2227,8 @@ sched_switch(struct thread *td, int flags) TD_SET_CAN_RUN(td); } else if (TD_IS_RUNNING(td)) { MPASS(mtx == TDQ_LOCKPTR(tdq)); - srqflag = preempted ? - SRQ_OURSELF|SRQ_YIELDING|SRQ_PREEMPTED : - SRQ_OURSELF|SRQ_YIELDING; + srqflag = SRQ_OURSELF | SRQ_YIELDING | + (preempted ? SRQ_PREEMPTED : 0); #ifdef SMP if (THREAD_CAN_MIGRATE(td) && (!THREAD_CAN_SCHED(td, ts->ts_cpu) || pickcpu))