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

From: Peter Zijlstra
Date: Tue Jul 09 2019 - 09:42:26 EST


On Tue, Jul 09, 2019 at 03:24:36PM +0200, luca abeni wrote:
> Hi Peter,
>
> On Mon, 8 Jul 2019 15:55:36 +0200
> Peter Zijlstra <peterz@xxxxxxxxxxxxx> wrote:
>
> > On Mon, May 06, 2019 at 06:48:33AM +0200, Luca Abeni wrote:
> > > @@ -1223,8 +1250,17 @@ static void update_curr_dl(struct rq *rq)
> > > dl_se->dl_overrun = 1;
> > >
> > > __dequeue_task_dl(rq, curr, 0);
> > > - if (unlikely(dl_se->dl_boosted
> > > || !start_dl_timer(curr)))
> > > + if (unlikely(dl_se->dl_boosted
> > > || !start_dl_timer(curr))) { enqueue_task_dl(rq, curr,
> > > ENQUEUE_REPLENISH); +#ifdef CONFIG_SMP
> > > + } else if (dl_se->dl_adjust) {
> > > + if (rq->migrating_task == NULL) {
> > > + queue_balance_callback(rq,
> > > &per_cpu(dl_migrate_head, rq->cpu), migrate_dl_task);
> >
> > I'm not entirely sure about this one.
> >
> > That is, we only do those callbacks from:
> >
> > schedule_tail()
> > __schedule()
> > rt_mutex_setprio()
> > __sched_setscheduler()
> >
> > and the above looks like it can happen outside of those.
>
> Sorry, I did not know the constraints or requirements for using
> queue_balance_callback()...
>
> I used it because I wanted to trigger a migration from
> update_curr_dl(), but invoking double_lock_balance() from this function
> obviously resulted in a warning. So, I probably misunderstood the
> purpose of the balance callback API, and I misused it.
>
> What would have been the "right way" to trigger a migration for a task
> when it is throttled?

I'm thinking we'll end up in schedule() pretty soon after a throttle to
make 'current' go away, right? We could put the queue_balance_callback()
in dequeue_task_dl() or something.