diff options
Diffstat (limited to 'kernel/timer.c')
-rw-r--r-- | kernel/timer.c | 13 |
1 files changed, 8 insertions, 5 deletions
diff --git a/kernel/timer.c b/kernel/timer.c index be394af5bc22..d8decb8d46b0 100644 --- a/kernel/timer.c +++ b/kernel/timer.c | |||
@@ -747,16 +747,19 @@ EXPORT_SYMBOL(mod_timer_pending); | |||
747 | static inline | 747 | static inline |
748 | unsigned long apply_slack(struct timer_list *timer, unsigned long expires) | 748 | unsigned long apply_slack(struct timer_list *timer, unsigned long expires) |
749 | { | 749 | { |
750 | unsigned long expires_limit, mask; | 750 | unsigned long expires_limit, mask, now; |
751 | int bit; | 751 | int bit; |
752 | 752 | ||
753 | expires_limit = expires; | 753 | expires_limit = expires; |
754 | 754 | ||
755 | if (timer->slack > -1) | 755 | if (timer->slack >= 0) { |
756 | expires_limit = expires + timer->slack; | 756 | expires_limit = expires + timer->slack; |
757 | else if (time_after(expires, jiffies)) /* auto slack: use 0.4% */ | 757 | } else { |
758 | expires_limit = expires + (expires - jiffies)/256; | 758 | now = jiffies; |
759 | 759 | /* No slack, if already expired else auto slack 0.4% */ | |
760 | if (time_after(expires, now)) | ||
761 | expires_limit = expires + (expires - now)/256; | ||
762 | } | ||
760 | mask = expires ^ expires_limit; | 763 | mask = expires ^ expires_limit; |
761 | if (mask == 0) | 764 | if (mask == 0) |
762 | return expires; | 765 | return expires; |