Re: [RFC PATCH 3/6] sched/dl: Try better placement even for deadline tasks that do not block

From: Juri Lelli
Date: Wed May 08 2019 - 05:23:27 EST


On 08/05/19 10:14, luca abeni wrote:
> Hi Juri,
>
> On Wed, 8 May 2019 10:01:16 +0200
> Juri Lelli <juri.lelli@xxxxxxxxxx> wrote:
>
> > Hi Luca,
> >
> > On 06/05/19 06:48, Luca Abeni wrote:
> > > From: luca abeni <luca.abeni@xxxxxxxxxxxxxxx>
> > >
> > > Currently, the scheduler tries to find a proper placement for
> > > SCHED_DEADLINE tasks when they are pushed out of a core or when
> > > they wake up. Hence, if there is a single SCHED_DEADLINE task
> > > that never blocks and wakes up, such a task is never migrated to
> > > an appropriate CPU core, but continues to execute on its original
> > > core.
> > >
> > > This commit addresses the issue by trying to migrate a
> > > SCHED_DEADLINE task (searching for an appropriate CPU core) the
> > > first time it is throttled.
> >
> > Why we failed to put the task on a CPU with enough (max) capacity
> > right after it passed admission control? The very first time the task
> > was scheduled I mean.
>
> I think the currently executing task cannot be pushed out of a
> CPU/core, right?
>
> So, if a task switches from SCHED_OTHER to SCHED_DEADLINE while it is
> executing on a fast core, the only way to migrate it would be to
> preempt it (by using the stop_sched_class, I think), no?
> (the typical situation here is a "cpu hog" task that switches from
> SCHED_OTHER to SCHED_DEADLINE, and it is the only SCHED_DEADLINE
> task... The task never blocks, so push/pull functions are never invoked)
>
> Or am I missing something?

OK, but "ideally" we should not be waiting to it to be throttled, right?

I wonder if you could queue a balance callback in switched_to_dl() (from
check_class_changed()), so that it is picked up by balance_callback()
before setscheduler returns.