Messages in this thread | | | Date | Thu, 2 Apr 2015 17:53:28 -0300 | From | Marcelo Tosatti <> | Subject | Re: kernel/timer: avoid spurious ksoftirqd wakeups |
| |
On Thu, Apr 02, 2015 at 09:58:26AM -0400, Rik van Riel wrote: > On 04/01/2015 09:44 PM, Marcelo Tosatti wrote: > > > +++ b/kernel/time/tick-sched.c > > @@ -568,6 +568,7 @@ static ktime_t tick_nohz_stop_sched_tick(struct tick_sched *ts, > > unsigned long rcu_delta_jiffies; > > struct clock_event_device *dev = __this_cpu_read(tick_cpu_device.evtdev); > > u64 time_delta; > > + bool raise_softirq; > > You may want to initialize this to false. Nothing else > in the code ever seems to set it to false. > > It may work in your test due to that address on the stack > already being zeroed out due to a lucky coincidence, but > that is not a guarantee. > > > --- a/kernel/time/timer.c > > +++ b/kernel/time/timer.c > > @@ -1343,7 +1343,7 @@ static unsigned long cmp_next_hrtimer_event(unsigned long now, > > * get_next_timer_interrupt - return the jiffy of the next pending timer > > * @now: current time (in jiffies) > > */ > > -unsigned long get_next_timer_interrupt(unsigned long now) > > +unsigned long get_next_timer_interrupt(unsigned long now, bool *raise_softirq) > > { > > struct tvec_base *base = __this_cpu_read(tvec_bases); > > unsigned long expires = now + NEXT_TIMER_MAX_DELTA; > > @@ -1357,6 +1357,7 @@ unsigned long get_next_timer_interrupt(unsigned long now) > > > > spin_lock(&base->lock); > > if (base->active_timers) { > > + *raise_softirq = true; > > if (time_before_eq(base->next_timer, base->timer_jiffies)) > > base->next_timer = __next_timer_interrupt(base); > > expires = base->next_timer; > > Given that run_timer_softirq() only actually does something > if the timer has expired, would it make sense to only raise > the softirq after the timer has expired?
jiffies might be increased by tick_nohz_stop_sched_tick.
So you'd have to test again after increasing jiffies.
| |