Re: [PATCH tip/core/timers 1/3] timers: Reduce __run_timers()latency for empty list

From: Oleg Nesterov
Date: Wed Jan 15 2014 - 11:26:27 EST


On 01/14, Paul E. McKenney wrote:
>
> On Tue, Jan 14, 2014 at 07:48:28PM +0100, Oleg Nesterov wrote:
> > > __internal_add_timer(struct tvec_base *base, struct timer_list *timer)
> > > {
> > > @@ -1146,6 +1157,10 @@ static inline void __run_timers(struct tvec_base *base)
> > > struct timer_list *timer;
> > >
> > > spin_lock_irq(&base->lock);
> >
> > Do we really need to take base->lock before catchup_timer_jiffies() ?
> > ->timer_jiffies can only be changed by us, and it seems that we do
> > not care if we race with base->active_timers++.
>
> Given that this lock should be almost always acquired by the current
> CPU, the penalty for acquiring it should be low. After all, we were
> acquiring it prior to this patch as many times as we are after this patch,
> right?

Yes. But

if (catchup_timer_jiffies())
return;

looks a bit simpler and can save a couple of insn. I won't argue of course,
this is minor. And you already sent v2, I'll try add some comments...

Oleg.

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/