git: a84a39dfe5d1 - main - kern/sched: move duplicate preemption stat vars into sched_shim.c
- Go to: [ bottom of page ] [ top of archives ] [ this month ]
Date: Thu, 29 Jan 2026 18:12:40 UTC
The branch main has been updated by kib:
URL: https://cgit.FreeBSD.org/src/commit/?id=a84a39dfe5d1fd98afdf29a74017fce29441b730
commit a84a39dfe5d1fd98afdf29a74017fce29441b730
Author: Konstantin Belousov <kib@FreeBSD.org>
AuthorDate: 2026-01-24 06:01:48 +0000
Commit: Konstantin Belousov <kib@FreeBSD.org>
CommitDate: 2026-01-29 18:11:56 +0000
kern/sched: move duplicate preemption stat vars into sched_shim.c
Tested by: pho
Sponsored by: The FreeBSD Foundation
MFC after: 1 week
Differential revision: https://reviews.freebsd.org/D54831
---
sys/kern/sched_4bsd.c | 4 ----
sys/kern/sched_shim.c | 5 +++++
sys/kern/sched_ule.c | 4 ----
sys/sys/sched.h | 3 +++
4 files changed, 8 insertions(+), 8 deletions(-)
diff --git a/sys/kern/sched_4bsd.c b/sys/kern/sched_4bsd.c
index 4c24d98173f3..55a70885ee28 100644
--- a/sys/kern/sched_4bsd.c
+++ b/sys/kern/sched_4bsd.c
@@ -706,10 +706,6 @@ sched_4bsd_rr_interval(void)
return (imax(1, (sched_slice * hz + realstathz / 2) / realstathz));
}
-SCHED_STAT_DEFINE(ithread_demotions, "Interrupt thread priority demotions");
-SCHED_STAT_DEFINE(ithread_preemptions,
- "Interrupt thread preemptions due to time-sharing");
-
/*
* We adjust the priority of the current process. The priority of a
* process gets worse as it accumulates CPU time. The cpu usage
diff --git a/sys/kern/sched_shim.c b/sys/kern/sched_shim.c
index f6b1285830fd..9d96c1a2d550 100644
--- a/sys/kern/sched_shim.c
+++ b/sys/kern/sched_shim.c
@@ -97,6 +97,11 @@ DEFINE_SHIM0(do_timer_accounting, bool, sched_do_timer_accounting)
DEFINE_SHIM1(find_l2_neighbor, int, sched_find_l2_neighbor, int, cpu)
DEFINE_SHIM0(init_ap, void, schedinit_ap)
+
+SCHED_STAT_DEFINE(ithread_demotions, "Interrupt thread priority demotions");
+SCHED_STAT_DEFINE(ithread_preemptions,
+ "Interrupt thread preemptions due to time-sharing");
+
static char sched_name[32] = "ULE";
SET_DECLARE(sched_instance_set, struct sched_selection);
diff --git a/sys/kern/sched_ule.c b/sys/kern/sched_ule.c
index 334b3c0f1de3..201d9c33dda7 100644
--- a/sys/kern/sched_ule.c
+++ b/sys/kern/sched_ule.c
@@ -2693,10 +2693,6 @@ sched_ule_userret_slowpath(struct thread *td)
thread_unlock(td);
}
-SCHED_STAT_DEFINE(ithread_demotions, "Interrupt thread priority demotions");
-SCHED_STAT_DEFINE(ithread_preemptions,
- "Interrupt thread preemptions due to time-sharing");
-
/*
* Return time slice for a given thread. For ithreads this is
* sched_slice. For other threads it is tdq_slice(tdq).
diff --git a/sys/sys/sched.h b/sys/sys/sched.h
index 3ba40fb191d3..bc8022084de3 100644
--- a/sys/sys/sched.h
+++ b/sys/sys/sched.h
@@ -231,6 +231,9 @@ SYSINIT(name, SI_SUB_LAST, SI_ORDER_MIDDLE, name ## _add_proc, NULL);
#define SCHED_STAT_INC(var) (void)0
#endif
+SCHED_STAT_DECLARE(ithread_demotions);
+SCHED_STAT_DECLARE(ithread_preemptions);
+
/*
* Fixup scheduler state for proc0 and thread0
*/