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

Unified · Split

3 files
  1. kernel/hrtimer.c +1 −1
  2. kernel/posix-timers.c +4 −7
  3. kernel/timer.c +7 −3
kernel/hrtimer.c+1−1
@@ -89,7 +89,7 @@ static void hrtimer_get_softirq_time(struct hrtimer_cpu_base *base) · 88 unmodified lines
8989
9090 do {
9191 seq = read_seqbegin(&xtime_lock);
92− xts = current_kernel_time();
92+ xts = __current_kernel_time();
9393 tom = wall_to_monotonic;
9494 } while (read_seqretry(&xtime_lock, seq));
9595
kernel/posix-timers.c+4−7
@@ -559,14 +559,7 @@ SYSCALL_DEFINE3(timer_create, const clockid_t, which_clock, · 558 unmodified lines
559559 new_timer->it_id = (timer_t) new_timer_id;
560560 new_timer->it_clock = which_clock;
561561 new_timer->it_overrun = -1;
562− error = CLOCK_DISPATCH(which_clock, timer_create, (new_timer));
563− if (error)
564− goto out;
565562
566− /*
567− * return the timer_id now. The next step is hard to
568− * back out if there is an error.
569− */
570563 if (copy_to_user(created_timer_id,
571564 &new_timer_id, sizeof (new_timer_id))) {
572565 error = -EFAULT;
@@ -597,6 +590,10 @@ SYSCALL_DEFINE3(timer_create, const clockid_t, which_clock, · 24 unmodified lines
597590 new_timer->sigq->info.si_tid = new_timer->it_id;
598591 new_timer->sigq->info.si_code = SI_TIMER;
599592
593+ error = CLOCK_DISPATCH(which_clock, timer_create, (new_timer));
594+ if (error)
595+ goto out;
596+
600597 spin_lock_irq(&current->sighand->siglock);
601598 new_timer->it_signal = current->signal;
602599 list_add(&new_timer->list, &current->signal->posix_timers);
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;