lkml.org 
[lkml]   [2006]   [Jun]   [29]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
Date
From
Subject[PATCH] no_idle_hz (s390/xen) 2.6.16.13: fix next_timer_interrupt() when timer pending
Fix next_timer_interrupt() to return the expired timeout of any
pending timer instead of the default "nothing scheduled" timeout
value of jiffies+MAX_JIFFY_OFFSET. See comment in patch for details.

Signed-off-by: Emmanuel Ackaouy <ack@xensource.com>


diff -pruN pristine-linux-2.6.16.13/kernel/timer.c linux-2.6.16.13-xen/kernel/timer.c
--- pristine-linux-2.6.16.13/kernel/timer.c 2006-05-02 22:38:44.000000000 +0100
+++ linux-2.6.16.13-xen/kernel/timer.c 2006-06-28 21:38:58.000000000 +0100
@@ -555,7 +555,17 @@ found:
}
spin_unlock(&base->t_base.lock);

- if (time_before(hr_expires, expires))
+ /*
+ * If timers are pending, "expires" will be in the recent past
+ * of "jiffies". If there are no hr_timers registered, "hr_expires"
+ * will be "jiffies + MAX_JIFFY_OFFSET"; this is *just* short of being
+ * considered to be before "jiffies". This makes it very likely that
+ * "hr_expires" *will* be considered to be before "expires".
+ * So we must check when there are pending timers (expires <= jiffies)
+ * to ensure that we don't accidently tell the caller that there is
+ * nothing scheduled until half an epoch (MAX_JIFFY_OFFSET)!
+ */
+ if (time_before(jiffies, expires) && time_before(hr_expires, expires))
return hr_expires;

return expires;
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
\
 
 \ /
  Last update: 2006-06-29 12:17    [W:0.048 / U:0.116 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site