From nobody Mon Sep 07 08:42:43 2026 X-Original-To: dev-commits-src-branches@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 4hdgYw08dSz6rhW9 for ; Mon, 07 Sep 2026 08:42:44 +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 "YR2" (not verified)) by mx1.freebsd.org (Postfix) with ESMTPS id 4hdgYv60clz44hD for ; Mon, 07 Sep 2026 08:42:43 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1788770563; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=gk7C7KUh+7TFLnpDNnVnEUU8EnLl403CWF7P19YZDks=; b=EeCPIyCJvYmg8EBI39LVxR9ypVjcHwIu/GuIyNtPeRoIq3Mff9di9j8WqCFkMjkC5JZpGo yJO4eFTdj3awk3MP1g0+IxBUHuXhBaWkEFBhm08HgTzWl60jinhemp3vQ4ZqAhhEPN0wct qSYrwzIIgte/yANxdpeFh5dbcL2I0b/0NwfSKgIbl/eVrJdMOl4mB7rFC0/Q3XnJDANZT4 GRPfN58fAf8D8eFXzx8+vPCvWT9wXNfPIn1ad5CaP6NymLg8GECFNiRZqc0vv9NykknOms EHIR0eRgIZNEZONsXA/ONwABO+DCLogHTM3tk6iOCAelwbcr7nTjfKdnFHyb5Q== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1788770563; a=rsa-sha256; cv=none; b=Ur7QPGx5ubXVKT+j0bgACpA7JW0CWP4TuyyHJaV2nSl7kVg5CRlKcEI4w40bOmicP0PX5v qjqm8X1sbAY59rzN8xleWuZxMUhew0g3UroQH3SvcdzSchEGz+2LfNd3FjbSiiaTRNhBsx qv40C64ClAJAdxk5nvprCkaRZY7HSR/4+FOlOFUNHZw7G1vCTJVXaBjhLKV8xmGMmrxvWf +1bwnRnydZpA5HcGu/FQ51FRYvG/SaPUhMh2c6R08sl9OycnLk/yJ4R2d0EudtUjZq7BKZ 9UMluRcZzOn52yGaCke7+z2QXlrlFrUa2TBSrib8hr5DwxYNq4IB0gCpteljTQ== 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=1788770563; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=gk7C7KUh+7TFLnpDNnVnEUU8EnLl403CWF7P19YZDks=; b=cKjjemFRY3nh+BtlGMPFwsURLQ3aFOXcSRB4UYjzncAWPrb9904+tGWtVWjUkmbS8yLDbp 3FpAmUbAqImKuwCP2B+wJDzP+ZrXuSSAeKgaeFgcHufmwe4RRxHVTNRKCuMNgnaRIvN92C IbABV3W+BTfEJQu3Ri2zi6FiZUgvBkUDJfOLT3uZ3/KuToQt125JVIuHYUHap7+zhWo0ZQ E8Yp5GpIBzowP40Ay//dLjfBm9W3vsfJTmfYdgoCBLaQ8k+DwuK+C4PWwS946XyySidpsR bwABAgycGk3CrBYNiSouLH6tiDiZAI+7k7MyDaecNRC4Ac14nQ8m1NBJbxpYow== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) by mxrelay.nyi.freebsd.org (Postfix) with ESMTP id 4hdgYv4HpPz19J9 for ; Mon, 07 Sep 2026 08:42:43 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from git (uid 1279) (envelope-from git@FreeBSD.org) id 3fe1d by gitrepo.freebsd.org (DragonFly Mail Agent v0.13+ on gitrepo.freebsd.org); Mon, 07 Sep 2026 08:42:43 +0000 To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org Cc: Minsoo Choo From: Olivier Certner Subject: git: 554eb7b46216 - stable/15 - sched_4bsd: Rename the global runqueue List-Id: Commits to the stable branches of the FreeBSD src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-branches List-Help: List-Post: List-Subscribe: List-Unsubscribe: X-BeenThere: dev-commits-src-branches@freebsd.org Sender: owner-dev-commits-src-branches@FreeBSD.org List-Id: List-Post: List-Help: List-Subscribe: List-Unsubscribe: List-Owner: Precedence: list 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/15 X-Git-Reftype: branch X-Git-Commit: 554eb7b46216506fa7c5c0c05535de2fd8d9b30e Auto-Submitted: auto-generated Date: Mon, 07 Sep 2026 08:42:43 +0000 Message-Id: <6a9e7903.3fe1d.128ea3f@gitrepo.freebsd.org> The branch stable/15 has been updated by olce: URL: https://cgit.FreeBSD.org/src/commit/?id=554eb7b46216506fa7c5c0c05535de2fd8d9b30e commit 554eb7b46216506fa7c5c0c05535de2fd8d9b30e Author: Minsoo Choo AuthorDate: 2026-07-20 02:34:13 +0000 Commit: Olivier Certner CommitDate: 2026-09-07 08:41:09 +0000 sched_4bsd: Rename the global runqueue In an upcoming change whose purpose is to stop having 4BSD always allocate MAXCPU runqueues, wasting space on most machines, 'struct td_sched' will store the CPU ID to which a thread is bound/pinned instead of a pointer to the corresponding runqueue. As a consequence, existing functions manipulating a thread's runqueue will need to point to the inferred runqueue through a local variable. The name 'runq' is the ideal one for these local variables, but before this change it designated the global runqueue, also causing unnecessary ambiguity. Thus, rename the global runqueue to the more explicit 'runq_global'. Arguably, this should have been performed as part of commit e17c57b14ba9 ("- Implement cpu pinning and binding. (...)"). No functional change (intended). [olce: Massaged the commit message. Tested with source builds.] Suggested by: olce Reviewed by: olce Tested by: olce MFC after: 2 weeks Differential Revision: https://reviews.freebsd.org/D58065 (cherry picked from commit 26ef6665344823f405c7fafba5baaacd9baacf72) --- sys/kern/sched_4bsd.c | 32 ++++++++++++++++---------------- 1 file changed, 16 insertions(+), 16 deletions(-) diff --git a/sys/kern/sched_4bsd.c b/sys/kern/sched_4bsd.c index 98c5cd8836a8..11dc2fbcec5b 100644 --- a/sys/kern/sched_4bsd.c +++ b/sys/kern/sched_4bsd.c @@ -110,7 +110,7 @@ struct td_sched { #define TSF_AFFINITY 0x0001 /* Has a non-"full" CPU set. */ #define SKE_RUNQ_PCPU(ts) \ - ((ts)->ts_runq != 0 && (ts)->ts_runq != &runq) + ((ts)->ts_runq != 0 && (ts)->ts_runq != &runq_global) #define THREAD_CAN_SCHED(td, cpu) \ CPU_ISSET((cpu), &(td)->td_cpuset->cs_mask) @@ -154,7 +154,7 @@ sched_4bsd_schedcpu(void) /* * Global run queue. */ -static struct runq runq; +static struct runq runq_global; #ifdef SMP /* @@ -182,7 +182,7 @@ setup_runqs(void) runq_init(&runq_pcpu[i]); #endif - runq_init(&runq); + runq_init(&runq_global); } static int @@ -682,10 +682,10 @@ static bool sched_4bsd_runnable(void) { #ifdef SMP - return (runq_not_empty(&runq) || + return (runq_not_empty(&runq_global) || runq_not_empty(&runq_pcpu[PCPU_GET(cpuid)])); #else - return (runq_not_empty(&runq)); + return (runq_not_empty(&runq_global)); #endif } @@ -1371,7 +1371,7 @@ sched_4bsd_add(struct thread *td, int flags) "sched_add: adding td_sched:%p (td:%p) to gbl runq", ts, td); cpu = NOCPU; - ts->ts_runq = &runq; + ts->ts_runq = &runq_global; } if ((td->td_flags & TDF_NOLOAD) == 0) @@ -1435,7 +1435,7 @@ sched_4bsd_add(struct thread *td, int flags) } TD_SET_RUNQ(td); CTR2(KTR_RUNQ, "sched_add: adding td_sched:%p (td:%p) to runq", ts, td); - ts->ts_runq = &runq; + ts->ts_runq = &runq_global; if ((td->td_flags & TDF_NOLOAD) == 0) sched_load_add(); @@ -1466,7 +1466,7 @@ sched_4bsd_rem(struct thread *td) if ((td->td_flags & TDF_NOLOAD) == 0) sched_load_rem(); #ifdef SMP - if (ts->ts_runq != &runq) + if (ts->ts_runq != &runq_global) runq_length[ts->ts_runq - runq_pcpu]--; #endif runq_remove(ts->ts_runq, td); @@ -1481,14 +1481,14 @@ static struct thread * sched_4bsd_choose(void) { struct thread *td; - struct runq *rq; + struct runq *runq; mtx_assert(&sched_lock, MA_OWNED); #ifdef SMP struct thread *tdcpu; - rq = &runq; - td = runq_choose_fuzz(&runq, runq_fuzz); + runq = &runq_global; + td = runq_choose_fuzz(&runq_global, runq_fuzz); tdcpu = runq_choose(&runq_pcpu[PCPU_GET(cpuid)]); if (td == NULL || @@ -1497,14 +1497,14 @@ sched_4bsd_choose(void) CTR2(KTR_RUNQ, "choosing td %p from pcpu runq %d", tdcpu, PCPU_GET(cpuid)); td = tdcpu; - rq = &runq_pcpu[PCPU_GET(cpuid)]; + runq = &runq_pcpu[PCPU_GET(cpuid)]; } else { CTR1(KTR_RUNQ, "choosing td_sched %p from main runq", td); } #else - rq = &runq; - td = runq_choose(&runq); + runq = &runq_global; + td = runq_choose(&runq_global); #endif if (td) { @@ -1512,7 +1512,7 @@ sched_4bsd_choose(void) if (td == tdcpu) runq_length[PCPU_GET(cpuid)]--; #endif - runq_remove(rq, td); + runq_remove(runq, td); td->td_flags |= TDF_DIDRUN; KASSERT(td->td_flags & TDF_INMEM, @@ -1794,7 +1794,7 @@ sched_4bsd_affinity(struct thread *td) * If we are on a per-CPU runqueue that is in the set, * then nothing needs to be done. */ - if (ts->ts_runq != &runq && + if (ts->ts_runq != &runq_global && THREAD_CAN_SCHED(td, ts->ts_runq - runq_pcpu)) return;