diff options
Diffstat (limited to 'kernel/timer.c')
| -rw-r--r-- | kernel/timer.c | 19 |
1 files changed, 13 insertions, 6 deletions
diff --git a/kernel/timer.c b/kernel/timer.c index be394af5bc22..ee305c8d4e18 100644 --- a/kernel/timer.c +++ b/kernel/timer.c | |||
| @@ -752,11 +752,15 @@ unsigned long apply_slack(struct timer_list *timer, unsigned long expires) | |||
| 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 | unsigned long now = jiffies; |
| 759 | 759 | ||
| 760 | /* No slack, if already expired else auto slack 0.4% */ | ||
| 761 | if (time_after(expires, now)) | ||
| 762 | expires_limit = expires + (expires - now)/256; | ||
| 763 | } | ||
| 760 | mask = expires ^ expires_limit; | 764 | mask = expires ^ expires_limit; |
| 761 | if (mask == 0) | 765 | if (mask == 0) |
| 762 | return expires; | 766 | return expires; |
| @@ -1680,11 +1684,14 @@ static int __cpuinit timer_cpu_notify(struct notifier_block *self, | |||
| 1680 | unsigned long action, void *hcpu) | 1684 | unsigned long action, void *hcpu) |
| 1681 | { | 1685 | { |
| 1682 | long cpu = (long)hcpu; | 1686 | long cpu = (long)hcpu; |
| 1687 | int err; | ||
| 1688 | |||
| 1683 | switch(action) { | 1689 | switch(action) { |
| 1684 | case CPU_UP_PREPARE: | 1690 | case CPU_UP_PREPARE: |
| 1685 | case CPU_UP_PREPARE_FROZEN: | 1691 | case CPU_UP_PREPARE_FROZEN: |
| 1686 | if (init_timers_cpu(cpu) < 0) | 1692 | err = init_timers_cpu(cpu); |
| 1687 | return NOTIFY_BAD; | 1693 | if (err < 0) |
| 1694 | return notifier_from_errno(err); | ||
| 1688 | break; | 1695 | break; |
| 1689 | #ifdef CONFIG_HOTPLUG_CPU | 1696 | #ifdef CONFIG_HOTPLUG_CPU |
| 1690 | case CPU_DEAD: | 1697 | case CPU_DEAD: |
| @@ -1710,7 +1717,7 @@ void __init init_timers(void) | |||
| 1710 | 1717 | ||
| 1711 | init_timer_stats(); | 1718 | init_timer_stats(); |
| 1712 | 1719 | ||
| 1713 | BUG_ON(err == NOTIFY_BAD); | 1720 | BUG_ON(err != NOTIFY_OK); |
| 1714 | register_cpu_notifier(&timers_nb); | 1721 | register_cpu_notifier(&timers_nb); |
| 1715 | open_softirq(TIMER_SOFTIRQ, run_timer_softirq); | 1722 | open_softirq(TIMER_SOFTIRQ, run_timer_softirq); |
| 1716 | } | 1723 | } |
