sched_4bsd: use the same switch flags as ULE

ULE uses the more specific SWT_REMOTEPREEMPT and SWT_REMOTEWAKEIDLE
switch types, let's do that here as well. SWT_PREEMPT is somewhat
redundant when we also have the SW_PREEMPT flag.

This only has an effect for kernels built with SCHED_STATS.

Reviewed by:	kib, markj
Sponsored by:	The FreeBSD Foundation
Differential Revision:	https://reviews.freebsd.org/D38183
This commit is contained in:
Mitchell Horne 2023-02-09 11:39:12 -04:00
parent 30cd6fd75d
commit bff02948ed

View File

@ -1542,13 +1542,17 @@ sched_choose(void)
void
sched_preempt(struct thread *td)
{
int flags;
SDT_PROBE2(sched, , , surrender, td, td->td_proc);
if (td->td_critnest > 1) {
td->td_owepreempt = 1;
} else {
thread_lock(td);
mi_switch(SW_INVOL | SW_PREEMPT | SWT_PREEMPT);
flags = SW_INVOL | SW_PREEMPT;
flags |= TD_IS_IDLETHREAD(td) ? SWT_REMOTEWAKEIDLE :
SWT_REMOTEPREEMPT;
mi_switch(flags);
}
}