linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Subhra Mazumdar <subhra.mazumdar@oracle.com>
To: Peter Zijlstra <peterz@infradead.org>
Cc: Viresh Kumar <viresh.kumar@linaro.org>,
	Ingo Molnar <mingo@redhat.com>,
	linux-kernel@vger.kernel.org,
	Vincent Guittot <vincent.guittot@linaro.org>,
	tkjos@google.com, Daniel Lezcano <daniel.lezcano@linaro.org>,
	quentin.perret@linaro.org, chris.redpath@arm.com,
	steven.sistare@oracle.com, songliubraving@fb.com
Subject: Re: [PATCH V3 2/2] sched/fair: Fallback to sched-idle CPU if idle CPU isn't found
Date: Tue, 2 Jul 2019 09:32:27 -0700	[thread overview]
Message-ID: <1fe415a7-a396-508c-f459-0ddcc36f3360@oracle.com> (raw)
In-Reply-To: <20190702083517.GY3419@hirez.programming.kicks-ass.net>


On 7/2/19 1:35 AM, Peter Zijlstra wrote:
> 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.

OK makes sense.

Thanks,
Subhra


  reply	other threads:[~2019-07-02 16:32 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-06-26  5:06 [PATCH V3 0/2] sched/fair: Fallback to sched-idle CPU in absence of idle CPUs Viresh Kumar
2019-06-26  5:06 ` [PATCH V3 1/2] sched: Start tracking SCHED_IDLE tasks count in cfs_rq Viresh Kumar
2019-07-25 16:15   ` [tip:sched/core] sched/fair: " tip-bot for Viresh Kumar
2019-06-26  5:06 ` [PATCH V3 2/2] sched/fair: Fallback to sched-idle CPU if idle CPU isn't found Viresh Kumar
2019-06-29  1:16   ` Subhra Mazumdar
2019-07-01  8:03     ` Viresh Kumar
2019-07-01 22:08       ` Subhra Mazumdar
2019-07-02  8:35         ` Peter Zijlstra
2019-07-02 16:32           ` Subhra Mazumdar [this message]
2019-07-25 16:16   ` [tip:sched/core] sched/fair: Fall back " tip-bot for Viresh Kumar
2019-07-01 13:43 ` [PATCH V3 0/2] sched/fair: Fallback to sched-idle CPU in absence of idle CPUs Peter Zijlstra
2019-07-03  9:13   ` Viresh Kumar
2019-12-09  3:50 ` Wanpeng Li
2019-12-10  6:33   ` Viresh Kumar
2019-12-10 11:15     ` Wanpeng Li

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1fe415a7-a396-508c-f459-0ddcc36f3360@oracle.com \
    --to=subhra.mazumdar@oracle.com \
    --cc=chris.redpath@arm.com \
    --cc=daniel.lezcano@linaro.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mingo@redhat.com \
    --cc=peterz@infradead.org \
    --cc=quentin.perret@linaro.org \
    --cc=songliubraving@fb.com \
    --cc=steven.sistare@oracle.com \
    --cc=tkjos@google.com \
    --cc=vincent.guittot@linaro.org \
    --cc=viresh.kumar@linaro.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).