[PATCH 01/12] hrtimer: round up relative start time

From: Roman Zippel
Date: Tue Feb 14 2006 - 05:09:13 EST



When starting a relative timer we have to round it up the next clock
tick to avoid an early expiry. The problem is that we don't know the
real clock resolution, so we have to assume the worst case, but it's
basically the same as the old code did, so it won't be worse than 2.6.15
and with a better clock interface we can improve this.

Signed-off-by: Roman Zippel <zippel@xxxxxxxxxxxxxx>

---

kernel/hrtimer.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)

Index: linux-2.6-git/kernel/hrtimer.c
===================================================================
--- linux-2.6-git.orig/kernel/hrtimer.c 2006-02-13 22:29:45.000000000 +0100
+++ linux-2.6-git/kernel/hrtimer.c 2006-02-13 22:29:51.000000000 +0100
@@ -419,7 +419,8 @@ hrtimer_start(struct hrtimer *timer, kti
new_base = switch_hrtimer_base(timer, base);

if (mode == HRTIMER_REL)
- tim = ktime_add(tim, new_base->get_time());
+ tim = ktime_add(ktime_add(tim, new_base->get_time()),
+ base->resolution);
timer->expires = tim;

enqueue_hrtimer(timer, new_base);
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/