lkml.org 
[lkml]   [2014]   [Jan]   [15]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [PATCH tip/core/timers 2/4] timers: Reduce __run_timers() latency for empty list
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



\
 
 \ /
  Last update: 2014-01-16 04:21    [W:0.750 / U:0.052 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site