[hrtimer] Enforce resolution as lower limit of intervals

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>

+5 -3
+1 -2
include/linux/hrtimer.h
··· 122 122 } 123 123 124 124 /* Forward a hrtimer so it expires after now: */ 125 - extern unsigned long hrtimer_forward(struct hrtimer *timer, 126 - const ktime_t interval); 125 + extern unsigned long hrtimer_forward(struct hrtimer *timer, ktime_t interval); 127 126 128 127 /* Precise sleep: */ 129 128 extern long hrtimer_nanosleep(struct timespec *rqtp,
+4 -1
kernel/hrtimer.c
··· 275 275 * The number of overruns is added to the overrun field. 276 276 */ 277 277 unsigned long 278 - hrtimer_forward(struct hrtimer *timer, const ktime_t interval) 278 + hrtimer_forward(struct hrtimer *timer, ktime_t interval) 279 279 { 280 280 unsigned long orun = 1; 281 281 ktime_t delta, now; ··· 286 286 287 287 if (delta.tv64 < 0) 288 288 return 0; 289 + 290 + if (interval.tv64 < timer->base->resolution.tv64) 291 + interval.tv64 = timer->base->resolution.tv64; 289 292 290 293 if (unlikely(delta.tv64 >= interval.tv64)) { 291 294 nsec_t incr = ktime_to_ns(interval);