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: Skip tasks with stale task_rq in bypass_lb_cpu()

bypass_lb_cpu() transfers tasks between per-CPU bypass DSQs without
migrating them - task_cpu() only updates when the donee later consumes the
task via move_remote_task_to_local_dsq(). If the LB timer fires again before
consumption and the new DSQ becomes a donor, @p is still on the previous CPU
and task_rq(@p) != donor_rq. @p can't be moved without its own rq locked.

Skip such tasks.

Fixes: 95d1df610cdc ("sched_ext: Implement load balancer for bypass mode")
Cc: stable@vger.kernel.org # v6.19+
Reported-by: Chris Mason <clm@meta.com>
Signed-off-by: Tejun Heo <tj@kernel.org>
Reviewed-by: Andrea Righi <arighi@nvidia.com>

+9
+9
kernel/sched/ext.c
··· 5023 5023 if (cpumask_empty(donee_mask)) 5024 5024 break; 5025 5025 5026 + /* 5027 + * If an earlier pass placed @p on @donor_dsq from a different 5028 + * CPU and the donee hasn't consumed it yet, @p is still on the 5029 + * previous CPU and task_rq(@p) != @donor_rq. @p can't be moved 5030 + * without its rq locked. Skip. 5031 + */ 5032 + if (task_rq(p) != donor_rq) 5033 + continue; 5034 + 5026 5035 donee = cpumask_any_and_distribute(donee_mask, p->cpus_ptr); 5027 5036 if (donee >= nr_cpu_ids) 5028 5037 continue;