Skip to content

Commit e9fe182

Browse files
committed
sched_ext: selftests/dsp_local_on: Fix sporadic failures
dsp_local_on has several incorrect assumptions, one of which is that p->nr_cpus_allowed always tracks p->cpus_ptr. This is not true when a task is scheduled out while migration is disabled - p->cpus_ptr is temporarily overridden to the previous CPU while p->nr_cpus_allowed remains unchanged. This led to sporadic test faliures when dsp_local_on_dispatch() tries to put a migration disabled task to a different CPU. Fix it by keeping the previous CPU when migration is disabled. There are SCX schedulers that make use of p->nr_cpus_allowed. They should also implement explicit handling for p->migration_disabled. Signed-off-by: Tejun Heo <[email protected]> Reported-by: Ihor Solodrai <[email protected]> Cc: Andrea Righi <[email protected]> Cc: Changwoo Min <[email protected]>
1 parent 74ca334 commit e9fe182

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

tools/testing/selftests/sched_ext/dsp_local_on.bpf.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ void BPF_STRUCT_OPS(dsp_local_on_dispatch, s32 cpu, struct task_struct *prev)
4343
if (!p)
4444
return;
4545

46-
if (p->nr_cpus_allowed == nr_cpus)
46+
if (p->nr_cpus_allowed == nr_cpus && !p->migration_disabled)
4747
target = bpf_get_prandom_u32() % nr_cpus;
4848
else
4949
target = scx_bpf_task_cpu(p);

0 commit comments

Comments
 (0)