From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751104AbcFXOeZ (ORCPT ); Fri, 24 Jun 2016 10:34:25 -0400 Received: from www.linutronix.de ([62.245.132.108]:53305 "EHLO Galois.linutronix.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751716AbcFXOeX (ORCPT ); Fri, 24 Jun 2016 10:34:23 -0400 Message-Id: <20160624141723.098625019@linutronix.de> User-Agent: quilt/0.63-1 Date: Fri, 24 Jun 2016 14:32:20 -0000 From: Thomas Gleixner To: LKML Cc: Ingo Molnar , Peter Zijlstra , "Paul E. McKenney" , Eric Dumazet , Frederic Weisbecker , Chris Mason , Arjan van de Ven , rt@linutronix.de, Rik van Riel , Linus Torvalds , George Spelvin , Len Brown , Josh Triplett Subject: [patch V3 20/22] timer: Only wake softirq if necessary References: <20160624140325.554996200@linutronix.de> MIME-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-15 Content-Disposition: inline; filename=timer--Only-wake-softirq-if-necessary.patch X-Linutronix-Spam-Score: -1.0 X-Linutronix-Spam-Level: - X-Linutronix-Spam-Status: No , -1.0 points, 5.0 required, ALL_TRUSTED=-1,SHORTCIRCUIT=-0.0001,URIBL_BLOCKED=0.001 Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org With the wheel forwading in place and with the HZ=1000 4ms folding we can avoid running the softirq at all. Signed-off-by: Thomas Gleixner --- kernel/time/timer.c | 11 +++++++++++ 1 file changed, 11 insertions(+) --- a/kernel/time/timer.c +++ b/kernel/time/timer.c @@ -1599,7 +1599,18 @@ static void run_timer_softirq(struct sof */ void run_local_timers(void) { + struct timer_base *base = this_cpu_ptr(&timer_bases[BASE_STD]); + hrtimer_run_queues(); + /* Raise the softirq only if required. */ + if (time_before(jiffies, base->clk)) { + if (!IS_ENABLED(CONFIG_NO_HZ_COMMON) || !base->nohz_active) + return; + /* CPU is awake, so check the deferrable base. */ + base++; + if (time_before(jiffies, base->clk)) + return; + } raise_softirq(TIMER_SOFTIRQ); }