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: Don't kick CPUs running higher classes

When a sched_ext scheduler tries to kick a CPU, the CPU may be running a
higher class task. sched_ext has no control over such CPUs. A sched_ext
scheduler couldn't have expected to get access to the CPU after kicking it
anyway. Skip kicking when the target CPU is running a higher class.

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

Tejun Heo a9c1fbbd 2dbbdeda

+8 -3
+8 -3
kernel/sched/ext.c
··· 5122 5122 { 5123 5123 struct rq *rq = cpu_rq(cpu); 5124 5124 struct scx_rq *this_scx = &this_rq->scx; 5125 + const struct sched_class *cur_class; 5125 5126 bool should_wait = false; 5126 5127 unsigned long flags; 5127 5128 5128 5129 raw_spin_rq_lock_irqsave(rq, flags); 5130 + cur_class = rq->curr->sched_class; 5129 5131 5130 5132 /* 5131 5133 * During CPU hotplug, a CPU may depend on kicking itself to make 5132 - * forward progress. Allow kicking self regardless of online state. 5134 + * forward progress. Allow kicking self regardless of online state. If 5135 + * @cpu is running a higher class task, we have no control over @cpu. 5136 + * Skip kicking. 5133 5137 */ 5134 - if (cpu_online(cpu) || cpu == cpu_of(this_rq)) { 5138 + if ((cpu_online(cpu) || cpu == cpu_of(this_rq)) && 5139 + !sched_class_above(cur_class, &ext_sched_class)) { 5135 5140 if (cpumask_test_cpu(cpu, this_scx->cpus_to_preempt)) { 5136 - if (rq->curr->sched_class == &ext_sched_class) 5141 + if (cur_class == &ext_sched_class) 5137 5142 rq->curr->scx.slice = 0; 5138 5143 cpumask_clear_cpu(cpu, this_scx->cpus_to_preempt); 5139 5144 }