diff options
author | Linus Torvalds <torvalds@linux-foundation.org> | 2010-05-28 13:16:27 -0400 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2010-05-28 13:16:27 -0400 |
commit | 29d03fa12bc02c0f8085cd6bb06d11359a4bccaf (patch) | |
tree | 0810a1b2bad0f853b270afed55eddc595ae8d2fc /kernel | |
parent | 89ad6a6173127e5d31bea7a4a45ec23fa5bf4a17 (diff) | |
parent | 45e0fffc8a7778282e6a1514a6ae3e7ae6545111 (diff) |
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')
-rw-r--r-- | kernel/hrtimer.c | 2 | ||||
-rw-r--r-- | kernel/posix-timers.c | 11 | ||||
-rw-r--r-- | kernel/timer.c | 10 |
3 files changed, 12 insertions, 11 deletions
diff --git a/kernel/hrtimer.c b/kernel/hrtimer.c index b9b134b35088..5c69e996bd0f 100644 --- a/kernel/hrtimer.c +++ b/kernel/hrtimer.c | |||
@@ -89,7 +89,7 @@ static void hrtimer_get_softirq_time(struct hrtimer_cpu_base *base) | |||
89 | 89 | ||
90 | do { | 90 | do { |
91 | seq = read_seqbegin(&xtime_lock); | 91 | seq = read_seqbegin(&xtime_lock); |
92 | xts = current_kernel_time(); | 92 | xts = __current_kernel_time(); |
93 | tom = wall_to_monotonic; | 93 | tom = wall_to_monotonic; |
94 | } while (read_seqretry(&xtime_lock, seq)); | 94 | } while (read_seqretry(&xtime_lock, seq)); |
95 | 95 | ||
diff --git a/kernel/posix-timers.c b/kernel/posix-timers.c index 00d1fda58ab6..ad723420acc3 100644 --- a/kernel/posix-timers.c +++ b/kernel/posix-timers.c | |||
@@ -559,14 +559,7 @@ SYSCALL_DEFINE3(timer_create, const clockid_t, which_clock, | |||
559 | new_timer->it_id = (timer_t) new_timer_id; | 559 | new_timer->it_id = (timer_t) new_timer_id; |
560 | new_timer->it_clock = which_clock; | 560 | new_timer->it_clock = which_clock; |
561 | new_timer->it_overrun = -1; | 561 | new_timer->it_overrun = -1; |
562 | error = CLOCK_DISPATCH(which_clock, timer_create, (new_timer)); | ||
563 | if (error) | ||
564 | goto out; | ||
565 | 562 | ||
566 | /* | ||
567 | * return the timer_id now. The next step is hard to | ||
568 | * back out if there is an error. | ||
569 | */ | ||
570 | if (copy_to_user(created_timer_id, | 563 | if (copy_to_user(created_timer_id, |
571 | &new_timer_id, sizeof (new_timer_id))) { | 564 | &new_timer_id, sizeof (new_timer_id))) { |
572 | error = -EFAULT; | 565 | error = -EFAULT; |
@@ -597,6 +590,10 @@ SYSCALL_DEFINE3(timer_create, const clockid_t, which_clock, | |||
597 | new_timer->sigq->info.si_tid = new_timer->it_id; | 590 | new_timer->sigq->info.si_tid = new_timer->it_id; |
598 | new_timer->sigq->info.si_code = SI_TIMER; | 591 | new_timer->sigq->info.si_code = SI_TIMER; |
599 | 592 | ||
593 | error = CLOCK_DISPATCH(which_clock, timer_create, (new_timer)); | ||
594 | if (error) | ||
595 | goto out; | ||
596 | |||
600 | spin_lock_irq(¤t->sighand->siglock); | 597 | spin_lock_irq(¤t->sighand->siglock); |
601 | new_timer->it_signal = current->signal; | 598 | new_timer->it_signal = current->signal; |
602 | list_add(&new_timer->list, ¤t->signal->posix_timers); | 599 | list_add(&new_timer->list, ¤t->signal->posix_timers); |
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) | |||
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; |