All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] timers: Set the deadline more accurately
@ 2014-05-21 10:45 Ross Lagerwall
  0 siblings, 0 replies; only message in thread
From: Ross Lagerwall @ 2014-05-21 10:45 UTC (permalink / raw)
  To: xen-devel; +Cc: Keir Fraser, Ian Jackson, Ian Campbell, Jan Beulich, Tim Deegan

Program the timer to the deadline of the closest timer if it is further
than 50us ahead, otherwise set it 50us ahead.  This way a single event
fires on time rather than 50us late (as it would have previously) while
still preventing too many timer wakeups in the case of having many
timers scheduled close together.

(where 50us is the timer_slop)

Signed-off-by: Ross Lagerwall <ross.lagerwall@citrix.com>
---
 xen/common/timer.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/xen/common/timer.c b/xen/common/timer.c
index 1895a78..f36aebc 100644
--- a/xen/common/timer.c
+++ b/xen/common/timer.c
@@ -492,8 +492,9 @@ static void timer_softirq_action(void)
         deadline = heap[1]->expires;
     if ( (ts->list != NULL) && (ts->list->expires < deadline) )
         deadline = ts->list->expires;
+    now = NOW();
     this_cpu(timer_deadline) =
-        (deadline == STIME_MAX) ? 0 : deadline + timer_slop;
+        (deadline == STIME_MAX) ? 0 : MAX(deadline, now + timer_slop);
 
     if ( !reprogram_timer(this_cpu(timer_deadline)) )
         raise_softirq(TIMER_SOFTIRQ);
-- 
1.9.0

^ permalink raw reply related	[flat|nested] only message in thread

only message in thread, other threads:[~2014-05-21 10:45 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-05-21 10:45 [PATCH] timers: Set the deadline more accurately Ross Lagerwall

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.