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: Tejun Heo
Date: Fri Aug 30 2024 - 13:35:21 EST
On Fri, Aug 30, 2024 at 12:22:07PM -0500, David Vernet wrote:
> 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().
Yes, this actually happens as a part of the scx_bpf_dispatch_from_dsq()
patchset - 0004-sched_ext-Make-dispatch_to_local_dsq-return-void.patch. I'll
update the title / description of that patchset.
Thanks.
--
tejun