From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S964843AbcGGIt6 (ORCPT ); Thu, 7 Jul 2016 04:49:58 -0400 Received: from terminus.zytor.com ([198.137.202.10]:39796 "EHLO terminus.zytor.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S964782AbcGGItx (ORCPT ); Thu, 7 Jul 2016 04:49:53 -0400 Date: Thu, 7 Jul 2016 01:48:28 -0700 From: tip-bot for Thomas Gleixner Message-ID: Cc: torvalds@linux-foundation.org, riel@redhat.com, hpa@zytor.com, peterz@infradead.org, mingo@kernel.org, paulmck@linux.vnet.ibm.com, linux@sciencehorizons.net, clm@fb.com, lenb@kernel.org, tglx@linutronix.de, josh@joshtriplett.org, linux-kernel@vger.kernel.org, arjan@infradead.org, fweisbec@gmail.com Reply-To: mingo@kernel.org, linux@sciencehorizons.net, paulmck@linux.vnet.ibm.com, clm@fb.com, lenb@kernel.org, torvalds@linux-foundation.org, riel@redhat.com, hpa@zytor.com, peterz@infradead.org, fweisbec@gmail.com, tglx@linutronix.de, josh@joshtriplett.org, arjan@infradead.org, linux-kernel@vger.kernel.org In-Reply-To: <20160704094342.607650550@linutronix.de> References: <20160704094342.607650550@linutronix.de> To: linux-tip-commits@vger.kernel.org Subject: [tip:timers/core] timers: Only wake softirq if necessary Git-Commit-ID: 4e85876a9d2a977b4a07389da8c07edf76d10825 X-Mailer: tip-git-log-daemon Robot-ID: Robot-Unsubscribe: Contact to get blacklisted from these emails MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Content-Type: text/plain; charset=UTF-8 Content-Disposition: inline Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Commit-ID: 4e85876a9d2a977b4a07389da8c07edf76d10825 Gitweb: http://git.kernel.org/tip/4e85876a9d2a977b4a07389da8c07edf76d10825 Author: Thomas Gleixner AuthorDate: Mon, 4 Jul 2016 09:50:37 +0000 Committer: Ingo Molnar CommitDate: Thu, 7 Jul 2016 10:35:11 +0200 timers: Only wake softirq if necessary 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 Cc: Arjan van de Ven Cc: Chris Mason Cc: Frederic Weisbecker Cc: George Spelvin Cc: Josh Triplett Cc: Len Brown Cc: Linus Torvalds Cc: Paul McKenney Cc: Peter Zijlstra Cc: Rik van Riel Cc: rt@linutronix.de Link: http://lkml.kernel.org/r/20160704094342.607650550@linutronix.de Signed-off-by: Ingo Molnar --- kernel/time/timer.c | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/kernel/time/timer.c b/kernel/time/timer.c index 9339d71..8d830f1 100644 --- a/kernel/time/timer.c +++ b/kernel/time/timer.c @@ -1608,7 +1608,18 @@ static void run_timer_softirq(struct softirq_action *h) */ 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); }