[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20190702083517.GY3419@hirez.programming.kicks-ass.net>
Date: Tue, 2 Jul 2019 10:35:17 +0200
From: Peter Zijlstra <peterz@...radead.org>
To: Subhra Mazumdar <subhra.mazumdar@...cle.com>
Cc: Viresh Kumar <viresh.kumar@...aro.org>,
Ingo Molnar <mingo@...hat.com>, linux-kernel@...r.kernel.org,
Vincent Guittot <vincent.guittot@...aro.org>, tkjos@...gle.com,
Daniel Lezcano <daniel.lezcano@...aro.org>,
quentin.perret@...aro.org, chris.redpath@....com,
steven.sistare@...cle.com, songliubraving@...com
Subject: Re: [PATCH V3 2/2] sched/fair: Fallback to sched-idle CPU if idle
CPU isn't found
On Mon, Jul 01, 2019 at 03:08:41PM -0700, Subhra Mazumdar wrote:
> On 7/1/19 1:03 AM, Viresh Kumar wrote:
> > On 28-06-19, 18:16, Subhra Mazumdar wrote:
> > > On 6/25/19 10:06 PM, Viresh Kumar wrote:
> > > > @@ -5376,6 +5376,15 @@ static struct {
> > > > #endif /* CONFIG_NO_HZ_COMMON */
> > > > +/* CPU only has SCHED_IDLE tasks enqueued */
> > > > +static int sched_idle_cpu(int cpu)
> > > > +{
> > > > + struct rq *rq = cpu_rq(cpu);
> > > > +
> > > > + return unlikely(rq->nr_running == rq->cfs.idle_h_nr_running &&
> > > > + rq->nr_running);
> > > > +}
> > > > +
> > > Shouldn't this check if rq->curr is also sched idle?
> > Why wouldn't the current set of checks be enough to guarantee that ?
> I thought nr_running does not include the on-cpu thread.
It very much does.
> > > And why not drop the rq->nr_running non zero check?
> > Because CPU isn't sched-idle if nr_running and idle_h_nr_running are both 0,
> > i.e. it is an IDLE cpu in that case. And so I thought it is important to have
> > this check as well.
> >
> idle_cpu() not only checks nr_running is 0 but also rq->curr == rq->idle
idle_cpu() will try very hard to declare a CPU !idle. But I don't see
how that it relevant. sched_idle_cpu() will only return true if there
are only SCHED_IDLE tasks on the CPU. Viresh's test is simple and
straight forward.
Powered by blists - more mailing lists