Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752249AbbDBUxo (ORCPT ); Thu, 2 Apr 2015 16:53:44 -0400 Received: from mx1.redhat.com ([209.132.183.28]:45870 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750771AbbDBUxn (ORCPT ); Thu, 2 Apr 2015 16:53:43 -0400 Date: Thu, 2 Apr 2015 17:53:28 -0300 From: Marcelo Tosatti To: Rik van Riel Cc: Frederic Weisbecker , linux-kernel@vger.kernel.org, Thomas Gleixner , "Paul E. McKenney" , Viresh Kumar Subject: Re: kernel/timer: avoid spurious ksoftirqd wakeups Message-ID: <20150402205328.GA11139@amt.cnet> References: <20150402014455.GA25970@amt.cnet> <551D4B02.30302@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <551D4B02.30302@redhat.com> User-Agent: Mutt/1.5.21 (2010-09-15) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 2080 Lines: 51 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. -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/