From: Christian Ludwig Subject: Avoid sending two IPIs to idle CPUs on wakeup To: Date: Fri, 2 Feb 2024 16:24:46 +0100 When waking up a process on an idle remote CPU, do not kick the remote side twice. In fact the remote CPU's scheduling context priority is invalid when the idle thread runs. --- sys/kern/kern_sched.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/sys/kern/kern_sched.c b/sys/kern/kern_sched.c index 731c615284d..0d5731fe07a 100644 --- a/sys/kern/kern_sched.c +++ b/sys/kern/kern_sched.c @@ -293,8 +293,7 @@ setrunqueue(struct cpu_info *ci, struct proc *p, uint8_t prio) if (cpuset_isset(&sched_idle_cpus, p->p_cpu)) cpu_unidle(p->p_cpu); - - if (prio < spc->spc_curpriority) + else if (prio < spc->spc_curpriority) need_resched(ci); } -- 2.34.1