git: f19009020a33 - main - sched: INVARIANTS: Check sched_preempt() is called on 'curthread'
- Go to: [ bottom of page ] [ top of archives ] [ this month ]
Date: Mon, 19 Oct 2026 09:07:28 UTC
The branch main has been updated by olce:
URL: https://cgit.FreeBSD.org/src/commit/?id=f19009020a33d07d7cad9393b4bf0a36f267cd07
commit f19009020a33d07d7cad9393b4bf0a36f267cd07
Author: Olivier Certner <olce@FreeBSD.org>
AuthorDate: 2026-10-13 08:31:36 +0000
Commit: Olivier Certner <olce@FreeBSD.org>
CommitDate: 2026-10-19 09:06:55 +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
---
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 63a3e0e66d66..96acd31d6419 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);