Re: [PATCH 1/2 sched_ext/for-6.12] sched_ext: Use task_can_run_on_remote_rq() test in dispatch_to_local_dsq()
From: David Vernet
Date: Fri Aug 30 2024 - 13:22:16 EST
On Fri, Aug 30, 2024 at 12:51:40AM -1000, Tejun Heo wrote:
> 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.
Should we also be falling back to the global DSQ if we fail the check
when called from process_ddsp_deferred_locals()? This patch doesn't
change anything given that we'd have the same behavior before if we
failed the cpumask_test_cpu(cpu_of(dst_rq), p->cpus_ptr) check, but I'm
not following why we would need to fall back to global DSQ in
finish_dispatch(), but not in process_ddsp_deferred_locals().
This doesn't affect the rest of the cleanup + fix, which LGTM:
Acked-by: David Vernet <void@xxxxxxxxxxxxx>
Thanks,
David
Attachment:
signature.asc
Description: PGP signature