From: Nicholas Piggin <npiggin@gmail.com>
To: Thomas Gleixner <tglx@linutronix.de>
Cc: akpm@linux-foundation.org, John Stultz <john.stultz@linaro.org>,
Stephen Boyd <sboyd@codeaurora.org>,
Jonathan.Cameron@huawei.com, paulmck@linux.vnet.ibm.com,
mpe@ellerman.id.au, dzickus@redhat.com, sfr@canb.auug.org.au,
linuxarm@huawei.com, abdhalee@linux.vnet.ibm.com,
sparclinux@vger.kernel.org, linuxppc-dev@lists.ozlabs.org,
linux-arm-kernel@lists.infradead.org,
linux-kernel@vger.kernel.org, torvalds@linux-foundation.org
Subject: Re: [PATCH resend] timers: Fix excessive granularity of new timers after a nohz idle
Date: Tue, 22 Aug 2017 18:06:30 +1000 [thread overview]
Message-ID: <20170822180630.6e1d7db5@roar.ozlabs.ibm.com> (raw)
In-Reply-To: <alpine.DEB.2.20.1708220842490.1869@nanos>
On Tue, 22 Aug 2017 09:45:46 +0200 (CEST)
Thomas Gleixner <tglx@linutronix.de> wrote:
> On Tue, 22 Aug 2017, Nicholas Piggin wrote:
> > I would have preferred to get comments from the timer maintainers, but
> > they've been busy or away for the past copule of weeks. Perhaps you
> > would consider carrying it until then?
>
> Yes, I was on vacation, but that patch never hit my LKML inbox ....
Hmm okay. Well that's fine, we're just getting done testing it here.
>
> > diff --git a/kernel/time/timer.c b/kernel/time/timer.c
> > index 8f5d1bf18854..dd7be9fe6839 100644
> > --- a/kernel/time/timer.c
> > +++ b/kernel/time/timer.c
> > @@ -203,6 +203,7 @@ struct timer_base {
> > bool migration_enabled;
> > bool nohz_active;
> > bool is_idle;
> > + bool was_idle; /* was it idle since last run/fwded */
>
> Please do not use tail comments. They are a horrible habit and disturb the
> reading flow.
Sure.
> I'm not fond of that name either. Something like forward_clk
> or a similar self explaining name would be appreciated.
Well I actually had that initially (must_forward). But on the other
hand that's less explanatory about the state of the timer base I thought.
Anyway I could go either way and you're going to be looking at this code
more than me in future :)
>
> > /*
> > @@ -938,6 +945,13 @@ __mod_timer(struct timer_list *timer, unsigned long expires, bool pending_only)
> > * same array bucket then just return:
> > */
> > if (timer_pending(timer)) {
> > + /*
> > + * The downside of this optimization is that it can result in
> > + * larger granularity than you would get from adding a new
> > + * timer with this expiry. Would a timer flag for networking
> > + * be appropriate, then we can try to keep expiry of general
> > + * timers within ~1/8th of their interval?
>
> This really depends on the timer usage type.
>
> If you use it merily for TCP timeouts or similar things, then this does not
> matter at all because then the timer is the safety net in case something
> goes wrong. If you lose packets on the transport the larger granularity is
> the least of your worries.
>
> From earlier discussions with the networking folks these timeouts are the
> reason for this optimization because you avoid the expensive
> dequeue/requeue operation if the successful communication is fast.
>
> If the timer has a short relative expiry and is used for sending packets or
> similar purposes, then it usually sits in the first bucket and has no
> granularity issues anyway. But from staring at trace data provided by
> google and facebook these timer are not rearmed while pending, they fire,
> do networking stuff and then get rearmed.
>
> So I rather avoid that kind of misleading comment. The first sentence
> surely can stay.
Right. The question was actually there for you to answer, so thanks. I
can certainly understand the use-case and importance of keeping it light.
> Other than that, nice detective work!
Thanks for taking a look (and thanks everyone who's been testing and
hacking on it). Do you want me to re-send with the changes?
Thanks,
Nick
prev parent reply other threads:[~2017-08-22 8:06 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-08-22 1:54 [PATCH resend] timers: Fix excessive granularity of new timers after a nohz idle Nicholas Piggin
2017-08-22 7:45 ` Thomas Gleixner
2017-08-22 8:06 ` Nicholas Piggin [this message]
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=20170822180630.6e1d7db5@roar.ozlabs.ibm.com \
--to=npiggin@gmail.com \
--cc=Jonathan.Cameron@huawei.com \
--cc=abdhalee@linux.vnet.ibm.com \
--cc=akpm@linux-foundation.org \
--cc=dzickus@redhat.com \
--cc=john.stultz@linaro.org \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linuxarm@huawei.com \
--cc=linuxppc-dev@lists.ozlabs.org \
--cc=mpe@ellerman.id.au \
--cc=paulmck@linux.vnet.ibm.com \
--cc=sboyd@codeaurora.org \
--cc=sfr@canb.auug.org.au \
--cc=sparclinux@vger.kernel.org \
--cc=tglx@linutronix.de \
--cc=torvalds@linux-foundation.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).