Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

sched_ext: Use the resched_cpu() to replace resched_curr() in the bypass_lb_node()

For the PREEMPT_RT kernels, the scx_bypass_lb_timerfn() running in the
preemptible per-CPU ktimer kthread context, this means that the following
scenarios will occur(for x86 platform):

cpu1 cpu2
ktimer kthread:
->scx_bypass_lb_timerfn
->bypass_lb_node
->for_each_cpu(cpu, resched_mask)

migration/1: by preempt by migration/2:
multi_cpu_stop() multi_cpu_stop()
->take_cpu_down()
->__cpu_disable()
->set cpu1 offline

->rq1 = cpu_rq(cpu1)
->resched_curr(rq1)
->smp_send_reschedule(cpu1)
->native_smp_send_reschedule(cpu1)
->if(unlikely(cpu_is_offline(cpu))) {
WARN(1, "sched: Unexpected
reschedule of offline CPU#%d!\n", cpu);
return;
}

This commit therefore use the resched_cpu() to replace resched_curr()
in the bypass_lb_node() to avoid send-ipi to offline CPUs.

Signed-off-by: Zqiang <qiang.zhang@linux.dev>
Reviewed-by: Andrea Righi <arighi@nvidia.com>
Signed-off-by: Tejun Heo <tj@kernel.org>

authored by

Zqiang and committed by
Tejun Heo
ccaeeb58 12494e5e

+2 -7
+2 -7
kernel/sched/ext.c
··· 3956 3956 nr_donor_target, nr_target); 3957 3957 } 3958 3958 3959 - for_each_cpu(cpu, resched_mask) { 3960 - struct rq *rq = cpu_rq(cpu); 3961 - 3962 - raw_spin_rq_lock_irq(rq); 3963 - resched_curr(rq); 3964 - raw_spin_rq_unlock_irq(rq); 3965 - } 3959 + for_each_cpu(cpu, resched_mask) 3960 + resched_cpu(cpu); 3966 3961 3967 3962 for_each_cpu_and(cpu, cpu_online_mask, node_mask) { 3968 3963 u32 nr = READ_ONCE(cpu_rq(cpu)->scx.bypass_dsq.nr);