mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Peter Zijlstra <peterz@infradead.org>
To: Vincent Guittot <vincent.guittot@linaro.org>
Cc: Ingo Molnar <mingo@kernel.org>,
	linux-kernel <linux-kernel@vger.kernel.org>,
	Valentin Schneider <valentin.schneider@arm.com>,
	Morten Rasmussen <morten.rasmussen@foss.arm.com>,
	Brendan Jackman <brendan.jackman@arm.com>,
	Dietmar Eggemann <dietmar.eggemann@arm.com>,
	Will Deacon <will.deacon@arm.com>
Subject: Re: [PATCH v2 1/3] sched: Stop nohz stats when decayed
Date: Thu, 8 Feb 2018 16:44:59 +0100	[thread overview]
Message-ID: <20180208154459.GA25181@hirez.programming.kicks-ass.net> (raw)
In-Reply-To: <CAKfTPtB0dDmovt=iM=efXUG1EY7GnOAuTTCf0VqTvx08fatWeQ@mail.gmail.com>

On Thu, Feb 08, 2018 at 04:05:58PM +0100, Vincent Guittot wrote:
> On 8 February 2018 at 15:00, Peter Zijlstra <peterz@infradead.org> wrote:
> > On Tue, Feb 06, 2018 at 08:23:05PM +0100, Vincent Guittot wrote:
> >
> >> @@ -9207,13 +9231,15 @@ void nohz_balance_enter_idle(int cpu)
> >>       if (!housekeeping_cpu(cpu, HK_FLAG_SCHED))
> >>               return;
> >>
> >> +     rq->has_blocked_load = 1;

Should we not set that with rq->lock held? We already clear it while
holding rq->lock.

> >> +
> >>       if (rq->nohz_tick_stopped)
> >> -             return;
> >
> > this case is difficult... needs thinking
> 
> The use case happens when a CPU wakes up and goes back to idle before
> the tick fires and clears nohz_tick_stopped.

Yes, and so we could have accrued blocked load. Now in this case the CPU
must already be set in the cpumask, but we could've already cleared
has_blocked.

My question is mostly about needing that "goto out" to set the flag,
because I think we can loose it on a store collision vs clearing it. But
in that case I suppose the iteration must already be in progress, which
in turn will observe rq->has_blocked_load and re-set nohz.has_blocked.

So yes, this is good, but could use a comment.

> > Without this ordering I think it would be possible to loose has_blocked
> > and not observe the CPU either.
> 
> I think that you are right.
> I also wondered if some barriers were necessary but wrongly concluded
> that set operation on nohz.idle_cpus_mask and WRITE_ONCE with volatile
> would be enough to ensure the right ordering

Yeah, so I forgot to write the comment in my patch, but it had the
barriers implied by cmpxchg.

  reply	other threads:[~2018-02-08 15:45 UTC|newest]

Thread overview: 22+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-02-06 19:23 [PATCH v2 0/3] Update blocked load Vincent Guittot
2018-02-06 19:23 ` [PATCH v2 1/3] sched: Stop nohz stats when decayed Vincent Guittot
2018-02-08 12:46   ` Valentin Schneider
2018-02-08 13:15     ` Peter Zijlstra
2018-02-08 13:36     ` Vincent Guittot
2018-02-08 19:21       ` Valentin Schneider
2018-02-09 11:41         ` Vincent Guittot
2018-02-09 12:16           ` Valentin Schneider
2018-02-08 14:00   ` Peter Zijlstra
2018-02-08 14:04     ` Peter Zijlstra
2018-02-08 15:05     ` Vincent Guittot
2018-02-08 15:44       ` Peter Zijlstra [this message]
2018-02-08 16:52         ` Vincent Guittot
2018-02-09 12:00           ` Peter Zijlstra
2018-02-08 15:30     ` Will Deacon
2018-02-08 15:46       ` Peter Zijlstra
2018-02-08 16:03         ` Will Deacon
2018-02-09  9:51           ` Andrea Parri
2018-02-06 19:23 ` [PATCH v2 2/3] sched: reduce the periodic update duration Vincent Guittot
2018-02-06 19:23 ` [PATCH v2 3/3] sched: update blocked load when newly idle Vincent Guittot
2018-02-06 21:25 ` [PATCH v2 0/3] Update blocked load Peter Zijlstra
2018-02-06 21:46   ` Vincent Guittot

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=20180208154459.GA25181@hirez.programming.kicks-ass.net \
    --to=peterz@infradead.org \
    --cc=brendan.jackman@arm.com \
    --cc=dietmar.eggemann@arm.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mingo@kernel.org \
    --cc=morten.rasmussen@foss.arm.com \
    --cc=valentin.schneider@arm.com \
    --cc=vincent.guittot@linaro.org \
    --cc=will.deacon@arm.com \
    /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

Powered by JetHome