Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1436227 > unrolled thread

[patch 4 20/22] timer: Only wake softirq if necessary

Started byThomas Gleixner <tglx@linutronix.de>
First post2016-07-04 12:00 +0200
Last post2016-07-07 11:00 +0200
Articles 2 — 2 participants

Back to article view | Back to linux.kernel

This discussion starts older than the indexed window; earlier articles aren't shown. The article labeled Started by below is the oldest one visible, not the original post.


Contents

  [patch 4 20/22] timer: Only wake softirq if necessary Thomas Gleixner <tglx@linutronix.de> - 2016-07-04 12:00 +0200
    [tip:timers/core] timers: Only wake softirq if necessary tip-bot for Thomas Gleixner <tipbot@zytor.com> - 2016-07-07 11:00 +0200

#1436227 — [patch 4 20/22] timer: Only wake softirq if necessary

FromThomas Gleixner <tglx@linutronix.de>
Date2016-07-04 12:00 +0200
Subject[patch 4 20/22] timer: Only wake softirq if necessary
Message-ID<rR8Pw-419-49@gated-at.bofh.it>
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 <tglx@linutronix.de>
---
 kernel/time/timer.c |   11 +++++++++++
 1 file changed, 11 insertions(+)

--- a/kernel/time/timer.c
+++ b/kernel/time/timer.c
@@ -1608,7 +1608,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);
 }
 

[toc] | [next] | [standalone]


#1438407 — [tip:timers/core] timers: Only wake softirq if necessary

Fromtip-bot for Thomas Gleixner <tipbot@zytor.com>
Date2016-07-07 11:00 +0200
Subject[tip:timers/core] timers: Only wake softirq if necessary
Message-ID<rSdk7-4BD-29@gated-at.bofh.it>
In reply to#1436227
Commit-ID:  4e85876a9d2a977b4a07389da8c07edf76d10825
Gitweb:     http://git.kernel.org/tip/4e85876a9d2a977b4a07389da8c07edf76d10825
Author:     Thomas Gleixner <tglx@linutronix.de>
AuthorDate: Mon, 4 Jul 2016 09:50:37 +0000
Committer:  Ingo Molnar <mingo@kernel.org>
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 <tglx@linutronix.de>
Cc: Arjan van de Ven <arjan@infradead.org>
Cc: Chris Mason <clm@fb.com>
Cc: Frederic Weisbecker <fweisbec@gmail.com>
Cc: George Spelvin <linux@sciencehorizons.net>
Cc: Josh Triplett <josh@joshtriplett.org>
Cc: Len Brown <lenb@kernel.org>
Cc: Linus Torvalds <torvalds@linux-foundation.org>
Cc: Paul McKenney <paulmck@linux.vnet.ibm.com>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Rik van Riel <riel@redhat.com>
Cc: rt@linutronix.de
Link: http://lkml.kernel.org/r/20160704094342.607650550@linutronix.de
Signed-off-by: Ingo Molnar <mingo@kernel.org>
---
 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);
 }
 

[toc] | [prev] | [standalone]


Back to top | Article view | linux.kernel


csiph-web