From: Andrea Righi Date: Thu, 13 Mar 2025 17:03:21 +0000 (+0100) Subject: sched_ext: Skip per-CPU tasks in scx_bpf_reenqueue_local() X-Git-Tag: v6.15-rc1~227^2~2 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=97e13ecb026684dcd428910701662275175a2315;p=thirdparty%2Fkernel%2Fstable.git sched_ext: Skip per-CPU tasks in scx_bpf_reenqueue_local() scx_bpf_reenqueue_local() can be invoked from ops.cpu_release() to give tasks that are queued to the local DSQ a chance to migrate to other CPUs, when a CPU is taken by a higher scheduling class. However, there is no point re-enqueuing tasks that can only run on that particular CPU, as they would simply be re-added to the same local DSQ without any benefit. Therefore, skip per-CPU tasks in scx_bpf_reenqueue_local(). Signed-off-by: Andrea Righi Signed-off-by: Tejun Heo --- diff --git a/kernel/sched/ext.c b/kernel/sched/ext.c index debcd1cf2de9b..db5bc4d57dba4 100644 --- a/kernel/sched/ext.c +++ b/kernel/sched/ext.c @@ -6621,8 +6621,12 @@ __bpf_kfunc u32 scx_bpf_reenqueue_local(void) * CPUs disagree, they use %ENQUEUE_RESTORE which is bypassed to * the current local DSQ for running tasks and thus are not * visible to the BPF scheduler. + * + * Also skip re-enqueueing tasks that can only run on this + * CPU, as they would just be re-added to the same local + * DSQ without any benefit. */ - if (p->migration_pending) + if (p->migration_pending || is_migration_disabled(p) || p->nr_cpus_allowed == 1) continue; dispatch_dequeue(rq, p);