]> www.pilppa.org Git - linux-2.6-omap-h63xx.git/commitdiff
[hrtimer] Enforce resolution as lower limit of intervals
authorThomas Gleixner <tglx@linutronix.de>
Thu, 12 Jan 2006 10:47:34 +0000 (11:47 +0100)
committerThomas Gleixner <tglx@linutronix.de>
Thu, 12 Jan 2006 10:47:34 +0000 (11:47 +0100)
Roman Zippel pointed out that the missing lower limit of intervals
leads to an accounting error in the overrun count. Enforce the lower
limit of intervals to resolution in the timer forwarding code.

Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
include/linux/hrtimer.h
kernel/hrtimer.c

index 98c5c1537b5d7e1c94924401d1476a548324e752..089bfb1fa01a771d7c11ee7de4227deb88d29b00 100644 (file)
@@ -122,8 +122,7 @@ static inline int hrtimer_active(const struct hrtimer *timer)
 }
 
 /* Forward a hrtimer so it expires after now: */
-extern unsigned long hrtimer_forward(struct hrtimer *timer,
-                                    const ktime_t interval);
+extern unsigned long hrtimer_forward(struct hrtimer *timer, ktime_t interval);
 
 /* Precise sleep: */
 extern long hrtimer_nanosleep(struct timespec *rqtp,
index 76d759ce62316e0a0ac8b69a02b4c753f9bec20f..04ccab099e84e3ce01125a540e02f49d216f5943 100644 (file)
@@ -275,7 +275,7 @@ void unlock_hrtimer_base(const struct hrtimer *timer, unsigned long *flags)
  * The number of overruns is added to the overrun field.
  */
 unsigned long
-hrtimer_forward(struct hrtimer *timer, const ktime_t interval)
+hrtimer_forward(struct hrtimer *timer, ktime_t interval)
 {
        unsigned long orun = 1;
        ktime_t delta, now;
@@ -287,6 +287,9 @@ hrtimer_forward(struct hrtimer *timer, const ktime_t interval)
        if (delta.tv64 < 0)
                return 0;
 
+       if (interval.tv64 < timer->base->resolution.tv64)
+               interval.tv64 = timer->base->resolution.tv64;
+
        if (unlikely(delta.tv64 >= interval.tv64)) {
                nsec_t incr = ktime_to_ns(interval);