git: bd74830ba874 - stable/15 - sched_shim: restore kern.ccpu sysctl
- Go to: [ bottom of page ] [ top of archives ] [ this month ]
Date: Wed, 11 Feb 2026 05:17:32 UTC
The branch stable/15 has been updated by kib:
URL: https://cgit.FreeBSD.org/src/commit/?id=bd74830ba874956a2d0cfe6691da379d084d8e9e
commit bd74830ba874956a2d0cfe6691da379d084d8e9e
Author: Konstantin Belousov <kib@FreeBSD.org>
AuthorDate: 2026-01-23 15:15:43 +0000
Commit: Konstantin Belousov <kib@FreeBSD.org>
CommitDate: 2026-02-11 05:12:37 +0000
sched_shim: restore kern.ccpu sysctl
(cherry picked from commit ff870b783f098cafd8b938379eada6b8cfe9a4fb)
---
sys/kern/sched_4bsd.c | 10 ++++++----
sys/kern/sched_shim.c | 4 ++++
2 files changed, 10 insertions(+), 4 deletions(-)
diff --git a/sys/kern/sched_4bsd.c b/sys/kern/sched_4bsd.c
index 11baf9d2bdfa..4c24d98173f3 100644
--- a/sys/kern/sched_4bsd.c
+++ b/sys/kern/sched_4bsd.c
@@ -436,10 +436,7 @@ maybe_preempt(struct thread *td)
#define loadfactor(loadav) (2 * (loadav))
#define decay_cpu(loadfac, cpu) (((loadfac) * (cpu)) / ((loadfac) + FSCALE))
-/* decay 95% of `ts_pctcpu' in 60 seconds; see CCPU_SHIFT before changing */
-static fixpt_t ccpu = 0.95122942450071400909 * FSCALE; /* exp(-1/20) */
-SYSCTL_UINT(_kern_sched_4bsd, OID_AUTO, ccpu, CTLFLAG_RD, &ccpu, 0,
- "Decay factor used for updating %CPU");
+extern fixpt_t ccpu;
/*
* If `ccpu' is not equal to `exp(-1/20)' and you still want to use the
@@ -638,6 +635,11 @@ resetpriority_thread(struct thread *td)
static void
sched_4bsd_setup(void)
{
+ /*
+ * Decay 95% of `ts_pctcpu' in 60 seconds; see CCPU_SHIFT
+ * before changing.
+ */
+ ccpu = 0.95122942450071400909 * FSCALE; /* exp(-1/20) */
setup_runqs();
diff --git a/sys/kern/sched_shim.c b/sys/kern/sched_shim.c
index 816d0b44bb52..f6b1285830fd 100644
--- a/sys/kern/sched_shim.c
+++ b/sys/kern/sched_shim.c
@@ -199,3 +199,7 @@ SYSCTL_PROC(_kern_sched, OID_AUTO, available,
CTLTYPE_STRING | CTLFLAG_RD | CTLFLAG_MPSAFE,
NULL, 0, sysctl_kern_sched_available, "A",
"List of available schedulers");
+
+fixpt_t ccpu;
+SYSCTL_UINT(_kern, OID_AUTO, ccpu, CTLFLAG_RD, &ccpu, 0,
+ "Decay factor used for updating %CPU");