]> err.no Git - linux-2.6/blobdiff - arch/s390/kernel/time.c
Merge with master.kernel.org:/pub/scm/linux/kernel/git/torvalds/linux-2.6.git
[linux-2.6] / arch / s390 / kernel / time.c
index 061e81138dc21b9293c410e829341b4d79ca8d78..8ca485676780de694b31134f2303b094e5053e68 100644 (file)
@@ -244,7 +244,7 @@ int sysctl_hz_timer = 1;
  */
 static inline void stop_hz_timer(void)
 {
-       __u64 timer;
+       __u64 timer, todval;
 
        if (sysctl_hz_timer != 0)
                return;
@@ -265,8 +265,14 @@ static inline void stop_hz_timer(void)
         * for the next event.
         */
        timer = (__u64) (next_timer_interrupt() - jiffies) + jiffies_64;
-       timer = jiffies_timer_cc + timer * CLK_TICKS_PER_JIFFY;
-       asm volatile ("SCKC %0" : : "m" (timer));
+       todval = -1ULL;
+       /* Be careful about overflows. */
+       if (timer < (-1ULL / CLK_TICKS_PER_JIFFY)) {
+               timer = jiffies_timer_cc + timer * CLK_TICKS_PER_JIFFY;
+               if (timer >= jiffies_timer_cc)
+                       todval = timer;
+       }
+       asm volatile ("SCKC %0" : : "m" (todval));
 }
 
 /*