All of lore.kernel.org
 help / color / mirror / Atom feed
From: Chris Metcalf <cmetcalf@mellanox.com>
To: Rik van Riel <riel@redhat.com>,
	Frederic Weisbecker <fweisbec@gmail.com>,
	Christoph Lameter <cl@linux.com>, Ingo Molnar <mingo@kernel.org>,
	Luiz Capitulino <lcapitulino@redhat.com>,
	Peter Zijlstra <peterz@infradead.org>,
	Thomas Gleixner <tglx@linutronix.de>,
	Viresh Kumar <viresh.kumar@linaro.org>,
	<linux-kernel@vger.kernel.org>
Subject: Re: [PATCH] nohz_full: Make sched_should_stop_tick() more conservative
Date: Mon, 4 Apr 2016 15:31:50 -0400	[thread overview]
Message-ID: <5702C126.1030904@mellanox.com> (raw)
In-Reply-To: <1459797143.6219.22.camel@redhat.com>

On 4/4/2016 3:12 PM, Rik van Riel wrote:
> On Fri, 2016-04-01 at 15:42 -0400, Chris Metcalf wrote:
>> On arm64, when calling enqueue_task_fair() from migration_cpu_stop(),
>> we find the nr_running value updated by add_nr_running(), but the
>> cfs.nr_running value has not always yet been updated.  Accordingly,
>> the sched_can_stop_tick() false returns true when we are migrating a
>> second task onto a core.
> I don't get it.
>
> Looking at the enqueue_task_fair(), I see this:
>
>          for_each_sched_entity(se) {
>                  cfs_rq = cfs_rq_of(se);
>                  cfs_rq->h_nr_running++;
> 		...
> 	}
>
>          if (!se)
>                  add_nr_running(rq, 1);
>
> What is the difference between cfs_rq->h_nr_running,
> and rq->cfs.nr_running?
>
> Why do we have two?
> Are we simply testing against the wrong one in
> sched_can_stop_tick?

It seems that using the non-CFS one is what we want.  I don't know whether
using a different CFS count instead might be more correct.

Since I'm not sure what causes the difference I see between tile (correct)
and arm64 (incorrect) it's hard for me to speculate.

>> Correct this by using rq->nr_running instead of rq->cfs.nr_running.
>> This should always be more conservative, and reverts the test to the
>> form it had before commit 76d92ac305f2 ("sched: Migrate sched to use
>> new tick dependency mask model").
> That would cause us to run the timer tick while running
> a single SCHED_RR real time task, with a single
> SCHED_OTHER task sitting in the background (which will
> not get run until the SCHED_RR task is done).

No, because in sched_can_stop_tick(), we first handle the special
cases of RR or FIFO tasks present.  For example, RR:

         if (rq->rt.rr_nr_running) {
                 if (rq->rt.rr_nr_running == 1)
                         return true;
                 else
                         return false;
         }

Once we see there's any RR tasks running, the return value
ignores any possible SCHED_OTHER tasks.  Only after the code
concludes there are no RR/FIFO tasks do we even look at
the over nr_running value.

-- 
Chris Metcalf, Mellanox Technologies
http://www.mellanox.com

  parent reply	other threads:[~2016-04-04 19:32 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-04-01 19:42 [PATCH] nohz_full: Make sched_should_stop_tick() more conservative Chris Metcalf
2016-04-04 19:12 ` Rik van Riel
2016-04-04 19:23   ` Peter Zijlstra
2016-04-18  2:00     ` Wanpeng Li
2016-04-21 14:42       ` Peter Zijlstra
2016-04-21 16:03         ` Peter Zijlstra
2016-04-25 21:30           ` Chris Metcalf
2016-04-28 10:24           ` [tip:sched/urgent] nohz/full, sched/rt: Fix missed tick-reenabling bug in sched_can_stop_tick() tip-bot for Peter Zijlstra
2016-04-28 13:30             ` Frederic Weisbecker
2016-04-04 19:31   ` Chris Metcalf [this message]
2016-04-04 19:36     ` [PATCH] nohz_full: Make sched_should_stop_tick() more conservative Rik van Riel
2016-04-05  0:27       ` Chris Metcalf

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=5702C126.1030904@mellanox.com \
    --to=cmetcalf@mellanox.com \
    --cc=cl@linux.com \
    --cc=fweisbec@gmail.com \
    --cc=lcapitulino@redhat.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mingo@kernel.org \
    --cc=peterz@infradead.org \
    --cc=riel@redhat.com \
    --cc=tglx@linutronix.de \
    --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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.