diff options
Diffstat (limited to 'kernel/timer.c')
-rw-r--r-- | kernel/timer.c | 20 |
1 files changed, 14 insertions, 6 deletions
diff --git a/kernel/timer.c b/kernel/timer.c index 9199f3c52215..2454172a80d3 100644 --- a/kernel/timer.c +++ b/kernel/timer.c | |||
@@ -750,13 +750,18 @@ unsigned long apply_slack(struct timer_list *timer, unsigned long expires) | |||
750 | unsigned long expires_limit, mask; | 750 | unsigned long expires_limit, mask; |
751 | int bit; | 751 | int bit; |
752 | 752 | ||
753 | expires_limit = expires + timer->slack; | 753 | expires_limit = expires; |
754 | 754 | ||
755 | if (timer->slack < 0) /* auto slack: use 0.4% */ | 755 | if (timer->slack >= 0) { |
756 | expires_limit = expires + (expires - jiffies)/256; | 756 | expires_limit = expires + timer->slack; |
757 | } else { | ||
758 | unsigned long now = jiffies; | ||
757 | 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 | } | ||
758 | mask = expires ^ expires_limit; | 764 | mask = expires ^ expires_limit; |
759 | |||
760 | if (mask == 0) | 765 | if (mask == 0) |
761 | return expires; | 766 | return expires; |
762 | 767 | ||
@@ -1679,11 +1684,14 @@ static int __cpuinit timer_cpu_notify(struct notifier_block *self, | |||
1679 | unsigned long action, void *hcpu) | 1684 | unsigned long action, void *hcpu) |
1680 | { | 1685 | { |
1681 | long cpu = (long)hcpu; | 1686 | long cpu = (long)hcpu; |
1687 | int err; | ||
1688 | |||
1682 | switch(action) { | 1689 | switch(action) { |
1683 | case CPU_UP_PREPARE: | 1690 | case CPU_UP_PREPARE: |
1684 | case CPU_UP_PREPARE_FROZEN: | 1691 | case CPU_UP_PREPARE_FROZEN: |
1685 | if (init_timers_cpu(cpu) < 0) | 1692 | err = init_timers_cpu(cpu); |
1686 | return NOTIFY_BAD; | 1693 | if (err < 0) |
1694 | return notifier_from_errno(err); | ||
1687 | break; | 1695 | break; |
1688 | #ifdef CONFIG_HOTPLUG_CPU | 1696 | #ifdef CONFIG_HOTPLUG_CPU |
1689 | case CPU_DEAD: | 1697 | case CPU_DEAD: |