From nobody Tue Jul 21 02:26:55 2026 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 4h41VS3Rhtz6lLpV for ; Tue, 21 Jul 2026 02:26:56 +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 "YR1" (not verified)) by mx1.freebsd.org (Postfix) with ESMTPS id 4h41VS1gx5z3mjK for ; Tue, 21 Jul 2026 02:26:56 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1784600816; 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=Z6vWo2KK1ijbAaDVaZbeEnYAIjpunybvAszhGtVqa/U=; b=LWQCyT8yM0edzeplHB6FdwPovLyiEVVoKzmtvT2XZZcDpOvhaTtuNV5xL4nNhXUOLKnIXr VgtmOeqR12BpK4VINXW9G6N7mOzmGShBcPMkQLzFaRYzdwDz/MHeQEgNkA56oeW5kMJLf6 p7QBtuN/NExHugdk8wvNHD//xlkK5Sw3+Yv4CGIhzIxT7JhSEyVvHvcwWnc3YUTuJ7tmlJ by0o2DA7DmhnCpTUFZ0GVhTNMQaoSlbrC1lxcc+S9RsgM21xE644UyDaO/vnISFNDmqq0R LN689Ug/n1x1R7L+c8yYoq2ZJifK9I290SXLvG7Ohr/WW9wLO/xRTxKFvOQFZA== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1784600816; a=rsa-sha256; cv=none; b=PG2QLn/1DSMpnbNMqETSVdh4fTgxbw5H5ns4p6cWx6kqwEqhD0Fi/CKmYZqa15atCW/qrV dbh/Dl4o1YkJpOOWaRY6k+Ht64Ac133Y4Hu0MvQeXcCCVzCvr8akc75040QxJ6V4GcNRzg ugygElhljwAdb0xs+jn0MDNRISEcZmRs2sZlzb6IRBFfp6eVKGmLMH7eibc+n3YHoiyVAV 9C19h9B0maSNi8Jn8cCA1Pw4ceIULOwV79SN9qD44PQmEPfhIeqop2V3n49e1JyfpZ5mvN w22cSyXHB64DGg245C4KFcJFyjxvNlMa2sZ0jmFupy6Qw/O4qrWnmXnvuFkdpQ== 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=1784600816; 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=Z6vWo2KK1ijbAaDVaZbeEnYAIjpunybvAszhGtVqa/U=; b=qM8L4ZOWLvsntX/Vlaj6CMPXLhcGOVmqxkBph+e1WfJGwb8VaiWD6JCqyl0my4CG+1ulMH 6l05JDToCiVcpDMcm04DMURQCipQPWKwmc4e0C24jnL3F+fdBf9+f0A3WligHcjkNF3OFn q20G+uEBVKsKB3FuOICJOzk9Yv2OhdLkre/2WlD8+mHVFzB4qAlzRHev+lJ/nrH9uFXjCJ nfHyRhsIWwvqNCAPAyXC2htki4boFUlZfvsHRKllV7cZ8+9RytKDtIG2aMGPyOp1IPCQS5 7HN5SznhRBmPRMEpANwvO4rfX1obTcqgFAS4kG1ESrxbrcyE6OagmDnn0u68aA== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) by mxrelay.nyi.freebsd.org (Postfix) with ESMTP id 4h41VS03fxzD1H for ; Tue, 21 Jul 2026 02:26:56 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from git (uid 1279) (envelope-from git@FreeBSD.org) id 1fbc7 by gitrepo.freebsd.org (DragonFly Mail Agent v0.13+ on gitrepo.freebsd.org); Tue, 21 Jul 2026 02:26:55 +0000 To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org Cc: Minsoo Choo From: Olivier Certner Subject: git: 26ef66653448 - main - sched_4bsd: Rename the global runqueue 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 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/main X-Git-Reftype: branch X-Git-Commit: 26ef6665344823f405c7fafba5baaacd9baacf72 Auto-Submitted: auto-generated Date: Tue, 21 Jul 2026 02:26:55 +0000 Message-Id: <6a5ed8ef.1fbc7.3173dc7f@gitrepo.freebsd.org> The branch main has been updated by olce: URL: https://cgit.FreeBSD.org/src/commit/?id=26ef6665344823f405c7fafba5baaacd9baacf72 commit 26ef6665344823f405c7fafba5baaacd9baacf72 Author: Minsoo Choo AuthorDate: 2026-07-20 02:34:13 +0000 Commit: Olivier Certner CommitDate: 2026-07-21 02:24:18 +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 --- 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;