History

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

Linus Torvalds committed 16 years ago

Commit 29d03fa2 parents 89ad6a6 45e0fff3 files · +12 −11Browse files

Showing the changes to kernel/timer.c (1 of 3 files). Show all

Unified · Split

kernel/timer.c+7−3
@@ -752,11 +752,15 @@ unsigned long apply_slack(struct timer_list *timer, unsigned long expires) · 751 unmodified lines
752752
753753 expires_limit = expires;
754754
755− if (timer->slack > -1)
755+ if (timer->slack >= 0) {
756756 expires_limit = expires + timer->slack;
757− else if (time_after(expires, jiffies)) /* auto slack: use 0.4% */
758− expires_limit = expires + (expires - jiffies)/256;
757+ } else {
758+ unsigned long now = jiffies;
759759
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+ }
760764 mask = expires ^ expires_limit;
761765 if (mask == 0)
762766 return expires;