[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <c4a8d1f044b721a2c396fa00a0244eff0b851ae4.camel@redhat.com>
Date: Tue, 28 Apr 2020 17:55:03 -0500
From: Scott Wood <swood@...hat.com>
To: Peter Zijlstra <peterz@...radead.org>,
Valentin Schneider <valentin.schneider@....com>
Cc: Steven Rostedt <rostedt@...dmis.org>,
Ingo Molnar <mingo@...hat.com>,
Vincent Guittot <vincent.guittot@...aro.org>,
Dietmar Eggemann <dietmar.eggemann@....com>,
Rik van Riel <riel@...riel.com>,
Mel Gorman <mgorman@...e.de>, linux-kernel@...r.kernel.org,
linux-rt-users <linux-rt-users@...r.kernel.org>
Subject: Re: [RFC PATCH 1/3] sched/fair: Call newidle_balance() from
finish_task_switch()
On Wed, 2020-04-29 at 00:09 +0200, Peter Zijlstra wrote:
> On Tue, Apr 28, 2020 at 10:37:18PM +0100, Valentin Schneider wrote:
> > On 28/04/20 06:02, Scott Wood wrote:
> > > Thus, newidle_balance() is entered with interrupts enabled, which
> > > allows
> > > (in the next patch) enabling interrupts when the lock is dropped.
> > >
> > > Signed-off-by: Scott Wood <swood@...hat.com>
> > > ---
> > > kernel/sched/core.c | 7 ++++---
> > > kernel/sched/fair.c | 45 ++++++++++++++++---------------------------
> > > -
> > > kernel/sched/sched.h | 6 ++----
> > > 3 files changed, 22 insertions(+), 36 deletions(-)
> > >
> > > diff --git a/kernel/sched/core.c b/kernel/sched/core.c
> > > index 9a2fbf98fd6f..0294beb8d16c 100644
> > > --- a/kernel/sched/core.c
> > > +++ b/kernel/sched/core.c
> > > @@ -3241,6 +3241,10 @@ static struct rq *finish_task_switch(struct
> > > task_struct *prev)
> > > }
> > >
> > > tick_nohz_task_switch();
> > > +
> > > + if (is_idle_task(current))
> > > + newidle_balance();
> > > +
> >
> > This means we must go through a switch_to(idle) before figuring out we
> > could've switched to a CFS task, and do it then. I'm curious to see the
> > performance impact of that.
>
> Also, if you move it this late, this is entirely the wrong place. If you
> do it after the context switch either use the balance_callback or put it
> in the idle path.
>
> But what Valentin said; this needs a fair bit of support, the whole
> reason we've never done this is to avoid that double context switch...
>
balance_callback() enters with the rq lock held but BH not separately
disabled, which interferes with the ability to enable interrupts but not BH.
It also gets called from rt_mutex_setprio() and __sched_setscheduler(), and
I didn't want the caller of those to be stuck with the latency.
-Scott
Powered by blists - more mailing lists