From: "Paul E. McKenney" <paulmck@linux.vnet.ibm.com>
To: Oleg Nesterov <oleg@redhat.com>
Cc: linux-kernel@vger.kernel.org, mingo@kernel.org,
laijs@cn.fujitsu.com, dipankar@in.ibm.com,
akpm@linux-foundation.org, mathieu.desnoyers@efficios.com,
josh@joshtriplett.org, niv@us.ibm.com, tglx@linutronix.de,
peterz@infradead.org, rostedt@goodmis.org, dhowells@redhat.com,
edumazet@google.com, darren@dvhart.com, fweisbec@gmail.com,
sbw@mit.edu
Subject: Re: [PATCH tip/core/timers 2/4] timers: Reduce __run_timers() latency for empty list
Date: Wed, 15 Jan 2014 18:14:53 -0800 [thread overview]
Message-ID: <20140116021453.GO10038@linux.vnet.ibm.com> (raw)
In-Reply-To: <20140115170310.GB11499@redhat.com>
On Wed, Jan 15, 2014 at 06:03:10PM +0100, Oleg Nesterov wrote:
> On 01/14, Paul E. McKenney wrote:
> >
> > The __run_timers() function currently steps through the list one jiffy at
> > a time
>
> And this is very suboptimal if jiffies - timer_jiffies is huge. Looks
> like, we should rework base->tv* structures, or (perhaps) optimize
> the "cascade" logic so that __run_timers() can increment timer_jiffies
> and move all the expired timers into work_list at one step. And the
> ->next_timer logic is obviously very suboptimal.
>
> But this is almost off-topic, I agree that in the short term these
> changes make sense.
>
> > +static bool catchup_timer_jiffies(struct tvec_base *base)
> > +{
> > +#ifdef CONFIG_NO_HZ_FULL
> > + if (!base->all_timers) {
> > + base->timer_jiffies = jiffies;
> > + return 1;
> > + }
> > +#endif /* #ifdef CONFIG_NO_HZ_FULL */
> > + return 0;
> > +}
> > +
> > static void
> > __internal_add_timer(struct tvec_base *base, struct timer_list *timer)
> > {
> > @@ -1150,6 +1161,10 @@ static inline void __run_timers(struct tvec_base *base)
> > struct timer_list *timer;
> >
> > spin_lock_irq(&base->lock);
> > + if (catchup_timer_jiffies(base)) {
> > + spin_unlock_irq(&base->lock);
> > + return;
> > + }
>
>
> This is really minor, but perhaps it would be better to modify
> run_timer_softirq() to call catchup_timer_jiffies() lockless along
> with another fast-path time_after_eq() check.
Given that this is at best a temporary solution, I would like to avoid
the complexity of this sort of optimization unless it turns out to be
a major performance issue.
> Better yet, it would be nice to avoid raise_softirq(TIMER_SOFTIRQ),
> but this is not simple due to hrtimer_run_pending().
And I do want to keep this pretty simple!
Thanx, Paul
next prev parent reply other threads:[~2014-01-16 2:15 UTC|newest]
Thread overview: 26+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-01-15 5:19 [PATCH v2 tip/core/timers] Crude timer-wheel latency hacks Paul E. McKenney
2014-01-15 5:20 ` [PATCH tip/core/timers 1/4] timers: Track total number of timers in list Paul E. McKenney
2014-01-15 5:20 ` [PATCH tip/core/timers 2/4] timers: Reduce __run_timers() latency for empty list Paul E. McKenney
2014-01-15 17:03 ` Oleg Nesterov
2014-01-15 17:10 ` Peter Zijlstra
2014-01-16 2:14 ` Paul E. McKenney [this message]
2014-01-15 17:38 ` Oleg Nesterov
2014-01-15 20:32 ` Josh Triplett
2014-01-15 20:47 ` Steven Rostedt
2014-01-16 2:22 ` Paul E. McKenney
2014-01-15 20:33 ` Josh Triplett
2014-01-16 2:23 ` Paul E. McKenney
2014-01-15 5:20 ` [PATCH tip/core/timers 3/4] timers: Reduce future __run_timers() latency for newly emptied list Paul E. McKenney
2014-01-15 17:08 ` Oleg Nesterov
2014-01-16 2:23 ` Paul E. McKenney
2014-01-15 20:54 ` Steven Rostedt
2014-01-15 23:41 ` Paul E. McKenney
2014-01-15 5:20 ` [PATCH tip/core/timers 4/4] timers: Reduce future __run_timers() latency for first add to empty list Paul E. McKenney
2014-01-15 17:24 ` Oleg Nesterov
2014-01-15 17:31 ` [PATCH 0/1] timers: internal_add_timer() should update ->next_timer if ->active_timers == 0 Oleg Nesterov
2014-01-15 17:31 ` [PATCH 1/1] " Oleg Nesterov
2014-01-15 20:56 ` Steven Rostedt
2014-01-16 2:10 ` Paul E. McKenney
2014-01-16 2:33 ` [PATCH tip/core/timers 4/4] timers: Reduce future __run_timers() latency for first add to empty list Paul E. McKenney
2014-01-15 22:22 ` [PATCH v2 tip/core/timers] Crude timer-wheel latency hacks Thomas Gleixner
2014-01-16 2:36 ` Paul E. McKenney
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=20140116021453.GO10038@linux.vnet.ibm.com \
--to=paulmck@linux.vnet.ibm.com \
--cc=akpm@linux-foundation.org \
--cc=darren@dvhart.com \
--cc=dhowells@redhat.com \
--cc=dipankar@in.ibm.com \
--cc=edumazet@google.com \
--cc=fweisbec@gmail.com \
--cc=josh@joshtriplett.org \
--cc=laijs@cn.fujitsu.com \
--cc=linux-kernel@vger.kernel.org \
--cc=mathieu.desnoyers@efficios.com \
--cc=mingo@kernel.org \
--cc=niv@us.ibm.com \
--cc=oleg@redhat.com \
--cc=peterz@infradead.org \
--cc=rostedt@goodmis.org \
--cc=sbw@mit.edu \
--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