public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH -rt] timer: upper bound on loops of __run_timers processing
@ 2014-12-30 19:52 Marcelo Tosatti
  2014-12-30 21:05 ` Rik van Riel
                   ` (2 more replies)
  0 siblings, 3 replies; 7+ messages in thread
From: Marcelo Tosatti @ 2014-12-30 19:52 UTC (permalink / raw)
  To: Thomas Gleixner
  Cc: Steven Rostedt, Clark Williams, Luiz Capitulino, Rik van Riel,
	linux-kernel


Commit "timers: do not raise softirq unconditionally", allows for timer
wheel processing (__run_timers) to be delayed for long periods of time.

The effect is that 

loops = jiffies - base->timer_jiffies

Can grow to very large values resulting in __run_timers taking hundreds
of milliseconds to execute.

Fix by creating an upper bound on the number of loops to be processed.
This allows a nohz=off kernel to achieve desired latencies.

Signed-off-by: Marcelo Tosatti <mtosatti@redhat.com>

diff --git a/kernel/timer.c b/kernel/timer.c
index f59e18c..c128416 100644
--- a/kernel/timer.c
+++ b/kernel/timer.c
@@ -1488,6 +1488,12 @@ void run_local_timers(void)
 	}
 #endif
 
+	if (time_after_eq(jiffies, base->timer_jiffies)) {
+		unsigned long jiffies_delta = jiffies - base->timer_jiffies;
+		if (jiffies_delta > TVR_SIZE)
+			raise_softirq(TIMER_SOFTIRQ);
+	}
+
 	if (!base->active_timers)
 		goto out;
 

^ permalink raw reply related	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2015-02-17 23:08 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-12-30 19:52 [PATCH -rt] timer: upper bound on loops of __run_timers processing Marcelo Tosatti
2014-12-30 21:05 ` Rik van Riel
2015-01-14 17:21 ` Marcelo Tosatti
2015-01-14 17:41   ` Steven Rostedt
2015-01-26 21:12   ` Marcelo Tosatti
2015-02-17 17:24     ` Sebastian Andrzej Siewior
2015-02-17 23:08 ` Rik van Riel

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox