git: c9e5bf3e6e39 - stable/15 - sched: INVARIANTS: Check sched_preempt() is called on 'curthread'
- Go to: [ bottom of page ] [ top of archives ] [ this month ]
Date: Wed, 04 Nov 2026 13:25:14 UTC
The branch stable/15 has been updated by olce:
URL: https://cgit.FreeBSD.org/src/commit/?id=c9e5bf3e6e39ecd301ca818e1fa43a976975d443
commit c9e5bf3e6e39ecd301ca818e1fa43a976975d443
Author: Olivier Certner <olce@FreeBSD.org>
AuthorDate: 2026-10-13 08:31:36 +0000
Commit: Olivier Certner <olce@FreeBSD.org>
CommitDate: 2026-11-04 13:21:36 +0000
sched: INVARIANTS: Check sched_preempt() is called on 'curthread'
sched_preempt() does not support operating on a remote thread. If you
are looking to influence CPU allocation on another thread, see, e.g.,
cpuset_setthread(), which in the end calls sched_affinity().
MFC after: 3 days
Sponsored by: The FreeBSD Foundation
(cherry picked from commit f19009020a33d07d7cad9393b4bf0a36f267cd07)
---
sys/kern/sched_4bsd.c | 1 +
sys/kern/sched_ule.c | 1 +
2 files changed, 2 insertions(+)
diff --git a/sys/kern/sched_4bsd.c b/sys/kern/sched_4bsd.c
index 431957c048eb..84d30b596d37 100644
--- a/sys/kern/sched_4bsd.c
+++ b/sys/kern/sched_4bsd.c
@@ -1544,6 +1544,7 @@ sched_4bsd_preempt(struct thread *td)
{
int flags;
+ MPASS(td == curthread);
SDT_PROBE2(sched, , , surrender, td, td->td_proc);
if (td->td_critnest > 1) {
td->td_owepreempt = 1;
diff --git a/sys/kern/sched_ule.c b/sys/kern/sched_ule.c
index ac19730cc262..f6aa8fc798e1 100644
--- a/sys/kern/sched_ule.c
+++ b/sys/kern/sched_ule.c
@@ -2660,6 +2660,7 @@ sched_ule_preempt(struct thread *td)
struct tdq *tdq;
int flags;
+ MPASS(td == curthread);
SDT_PROBE2(sched, , , surrender, td, td->td_proc);
thread_lock(td);