summaryrefslogtreecommitdiff
path: root/kernel/timer.c
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@linux-foundation.org>2010-05-28 21:16:27 +0400
committerLinus Torvalds <torvalds@linux-foundation.org>2010-05-28 21:16:27 +0400
commit29d03fa12bc02c0f8085cd6bb06d11359a4bccaf (patch)
tree0810a1b2bad0f853b270afed55eddc595ae8d2fc /kernel/timer.c
parent89ad6a6173127e5d31bea7a4a45ec23fa5bf4a17 (diff)
parent45e0fffc8a7778282e6a1514a6ae3e7ae6545111 (diff)
downloadlinux-29d03fa12bc02c0f8085cd6bb06d11359a4bccaf.tar.xz
Merge branch 'timers-fixes-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/linux-2.6-tip
* 'timers-fixes-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/linux-2.6-tip: posix_timer: Fix error path in timer_create hrtimer: Avoid double seqlock timers: Move local variable into else section timers: Fix slack calculation really
Diffstat (limited to 'kernel/timer.c')
-rw-r--r--kernel/timer.c10
1 files changed, 7 insertions, 3 deletions
diff --git a/kernel/timer.c b/kernel/timer.c
index e3b8c697bde4..2454172a80d3 100644
--- a/kernel/timer.c
+++ b/kernel/timer.c
@@ -752,11 +752,15 @@ unsigned long apply_slack(struct timer_list *timer, unsigned long expires)
expires_limit = expires;
- if (timer->slack > -1)
+ if (timer->slack >= 0) {
expires_limit = expires + timer->slack;
- else if (time_after(expires, jiffies)) /* auto slack: use 0.4% */
- expires_limit = expires + (expires - jiffies)/256;
+ } else {
+ unsigned long now = jiffies;
+ /* No slack, if already expired else auto slack 0.4% */
+ if (time_after(expires, now))
+ expires_limit = expires + (expires - now)/256;
+ }
mask = expires ^ expires_limit;
if (mask == 0)
return expires;