sched_ext: Use task_can_run_on_remote_rq() test in dispatch_to_local_dsq()
authorTejun Heo <tj@kernel.org>
Fri, 30 Aug 2024 10:51:40 +0000 (00:51 -1000)
committerTejun Heo <tj@kernel.org>
Sat, 31 Aug 2024 05:34:46 +0000 (19:34 -1000)
commit0366017e0973a52245787e972c8ac68a88692bba
treef94cea5b68aab6fe639ff810f754df06d2832633
parentbf934bed5e2fd81f767d75c05fb95f0333a1b183
sched_ext: Use task_can_run_on_remote_rq() test in dispatch_to_local_dsq()

When deciding whether a task can be migrated to a CPU,
dispatch_to_local_dsq() was open-coding p->cpus_allowed and scx_rq_online()
tests instead of using task_can_run_on_remote_rq(). This had two problems.

- It was missing is_migration_disabled() check and thus could try to migrate
  a task which shouldn't leading to assertion and scheduling failures.

- It was testing p->cpus_ptr directly instead of using task_allowed_on_cpu()
  and thus failed to consider ISA compatibility.

Update dispatch_to_local_dsq() to use task_can_run_on_remote_rq():

- Move scx_ops_error() triggering into task_can_run_on_remote_rq().

- When migration isn't allowed, fall back to the global DSQ instead of the
  source DSQ by returning DTL_INVALID. This is both simpler and an overall
  better behavior.

Signed-off-by: Tejun Heo <tj@kernel.org>
Cc: Peter Zijlstra <peterz@infradead.org>
Acked-by: David Vernet <void@manifault.com>
kernel/sched/ext.c