Re: [PATCH v2 2/6] sched/rt: Re-instate old behavior in select_task_rq_rt

From: Qais Yousef
Date: Wed Feb 26 2020 - 06:34:25 EST


On 02/25/20 15:21, Dietmar Eggemann wrote:
> On 23.02.20 18:39, Qais Yousef wrote:
>
> [...]
>
> > diff --git a/kernel/sched/rt.c b/kernel/sched/rt.c
> > index 4043abe45459..2c3fae637cef 100644
> > --- a/kernel/sched/rt.c
> > +++ b/kernel/sched/rt.c
> > @@ -1474,6 +1474,13 @@ select_task_rq_rt(struct task_struct *p, int cpu, int sd_flag, int flags)
> > if (test || !rt_task_fits_capacity(p, cpu)) {
> > int target = find_lowest_rq(p);
> >
> > + /*
> > + * Bail out if we were forcing a migration to find a better
> > + * fitting CPU but our search failed.
> > + */
> > + if (!test && !rt_task_fits_capacity(p, target))
> > + goto out_unlock;
>
> Didn't you loose the 'target != -1' condition from
> https://lore.kernel.org/r/20200218041620.GD28029@xxxxxxxxxxxxxx ?
>
> A call to rt_task_fits_capacity(p, -1) would cause issues on a
> heterogeneous system.

Good catch! Right you are. I'll fix this and send v3, once it is clear what
would be right way forward to handle the wakeup-path.

Thanks!

--
Qais Yousef

>
> I tried to provoke this but wasn't able to do so. find_lowest_rq()
> returns -1 in 4 places. (1) lowest_mask should be there (2) if
> 'task->nr_cpus_allowed == 1' select_task_rq_rt() wouldn't have been
> called but maybe (3) or (4) can still return -1.
>
> [...]