From: Peter Zijlstra <peterz@infradead.org>
To: Scott Wood <swood@redhat.com>
Cc: Thomas Gleixner <tglx@linutronix.de>,
Frederic Weisbecker <frederic@kernel.org>,
Ingo Molnar <mingo@kernel.org>,
LKML <linux-kernel@vger.kernel.org>
Subject: Re: [PATCH] timers/nohz: Update nohz load even if tick already stopped
Date: Wed, 6 Nov 2019 09:37:49 +0100 [thread overview]
Message-ID: <20191106083749.GJ5671@hirez.programming.kicks-ass.net> (raw)
In-Reply-To: <20191105124351.GN4131@hirez.programming.kicks-ass.net>
On Tue, Nov 05, 2019 at 01:43:51PM +0100, Peter Zijlstra wrote:
> On Tue, Nov 05, 2019 at 01:30:58AM -0600, Scott Wood wrote:
> > The warning is due to kernel/sched/idle.c not updating curr->se.exec_start.
>
> Ah, indeed so.
>
> > While debugging I noticed an issue with a particular load pattern. The CPU
> > goes non-nohz for a brief time at an interval very close to twice
> > tick_period. When the tick is started, the timer expiration is more than
> > tick_period in the past, so hrtimer_forward() tries to catch up by adding
> > 2*tick_period to the expiration. Then the tick is stopped before that new
> > expiration, and when the tick is woken up the expiry is again advanced by
> > 2*tick_period with the timer never actually running. sched_tick_remote()
> > does fire every second, but there are streaks of several seconds where it
> > keeps catching the CPU in a non-nohz state, so neither the normal nor remote
> > ticks are calling calc_load_nohz_remote().
> >
> > Is there a reason to not just remove the hrtimer_forward() from
> > tick_nohz_restart(), letting the timer fire if it's in the past, which will
> > take care of doing hrtimer_forward()?
>
> I'll have to look into that. I always get confused by all that nohz code
> :/
>
> > As for the warning in sched_tick_remote(), it seems like a test for time
> > since the last tick on this cpu (remote or otherwise) would be better than
> > relying on curr->se.exec_start, in order to detect things like this.
>
> I don't think we have a timestamp that is shared between the remote and
> local tick. Also, there is a reason this warning uses the task time
> accounting, there used to be (as in, I can't find it in a hurry) code
> that could not deal with >u32 (~4s) clock updates.
>
> The below should have idle keep the timestamp up-to-date. Keeping
> accurate idle->se.sum_exec_runtime doesn't seem too interesting, the
> idle code already keeps track of total idle times.
>
> ---
The obvious alternative is something like:
if (rq->curr != rq->idle) {
s64 delta = rq_clock_task(rq) - curr->se.exec_start;
WARN_ON_ONCE(delta > 3ULL * NSEC_PER_SEC);
}
Which would avoid polluting the idle path with that extra assignment.
next prev parent reply other threads:[~2019-11-06 8:37 UTC|newest]
Thread overview: 15+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-10-28 15:07 [PATCH] timers/nohz: Update nohz load even if tick already stopped Frederic Weisbecker
2019-10-29 10:05 ` Peter Zijlstra
2019-10-30 8:48 ` Scott Wood
2019-10-30 13:31 ` Peter Zijlstra
2019-11-01 5:11 ` Scott Wood
2019-11-04 22:17 ` Thomas Gleixner
2019-11-04 23:43 ` Thomas Gleixner
2019-11-05 7:30 ` Scott Wood
2019-11-05 9:53 ` Thomas Gleixner
2019-11-08 8:16 ` Scott Wood
2019-11-05 12:43 ` Peter Zijlstra
2019-11-06 8:37 ` Peter Zijlstra [this message]
2019-11-08 8:13 ` Scott Wood
2019-12-11 20:37 ` Scott Wood
2019-12-11 20:46 ` Scott Wood
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=20191106083749.GJ5671@hirez.programming.kicks-ass.net \
--to=peterz@infradead.org \
--cc=frederic@kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=mingo@kernel.org \
--cc=swood@redhat.com \
--cc=tglx@linutronix.de \
/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