[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20190709152436.51825f98@luca64>
Date: Tue, 9 Jul 2019 15:24:36 +0200
From: luca abeni <luca.abeni@...tannapisa.it>
To: Peter Zijlstra <peterz@...radead.org>
Cc: linux-kernel@...r.kernel.org,
Greg Kroah-Hartman <gregkh@...uxfoundation.org>,
"Rafael J . Wysocki" <rafael@...nel.org>,
Ingo Molnar <mingo@...hat.com>,
Vincent Guittot <vincent.guittot@...aro.org>,
"Paul E . McKenney" <paulmck@...ux.ibm.com>,
Joel Fernandes <joel@...lfernandes.org>,
Quentin Perret <quentin.perret@....com>,
Luc Van Oostenryck <luc.vanoostenryck@...il.com>,
Morten Rasmussen <morten.rasmussen@....com>,
Juri Lelli <juri.lelli@...hat.com>,
Daniel Bristot de Oliveira <bristot@...hat.com>,
Patrick Bellasi <patrick.bellasi@....com>,
Tommaso Cucinotta <tommaso.cucinotta@...tannapisa.it>,
Dietmar Eggemann <dietmar.eggemann@....com>
Subject: Re: [RFC PATCH 3/6] sched/dl: Try better placement even for
deadline tasks that do not block
Hi Peter,
On Mon, 8 Jul 2019 15:55:36 +0200
Peter Zijlstra <peterz@...radead.org> 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?
>
> The pattern in those sites is:
>
> rq_lock();
> ... do crap that leads to queue_balance_callback()
> rq_unlock()
> if (rq->balance_callback) {
> raw_spin_lock_irqsave(rq->lock, flags);
> ... do callbacks
> raw_spin_unlock_irqrestore(rq->lock, flags);
> }
>
> So I suppose can catch abuse of this API by doing something like the
> below; can you validate?
Sorry; right now I cannot run tests on big.LITTLE machines...
Maybe Dietmar (added in cc), who is working on mainlining this patcset,
can test?
Thanks,
Luca
>
> ---
>
> diff --git a/kernel/sched/sched.h b/kernel/sched/sched.h
> index aaca0e743776..89e615f1eae6 100644
> --- a/kernel/sched/sched.h
> +++ b/kernel/sched/sched.h
> @@ -1134,6 +1134,14 @@ static inline void rq_pin_lock(struct rq *rq,
> struct rq_flags *rf) rf->cookie = lockdep_pin_lock(&rq->lock);
>
> #ifdef CONFIG_SCHED_DEBUG
> +#ifdef CONFIG_SMP
> + /*
> + * There should not be pending callbacks at the start of
> rq_lock();
> + * all sites that handle them flush them at the end.
> + */
> + WARN_ON_ONCE(rq->balance_callback);
> +#endif
> +
> rq->clock_update_flags &= (RQCF_REQ_SKIP|RQCF_ACT_SKIP);
> rf->clock_update_flags = 0;
> #endif
Powered by blists - more mailing lists