diff options
author | Linus Torvalds <torvalds@linux-foundation.org> | 2010-08-06 16:12:36 -0400 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2010-08-06 16:12:36 -0400 |
commit | af390084359a5de20046c901529b2b6a50b941cb (patch) | |
tree | b73a6261d1b1f9fb34432cc9a47411a49330b8dc /kernel | |
parent | 7645e4320497b35ce9fb6c2269ebcd57af9fe735 (diff) | |
parent | 0fcb80818bc3ade5befd409051089f710adcf7b0 (diff) |
Merge branch 'timers-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/linux-2.6-tip
* 'timers-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/linux-2.6-tip:
Documentation: Add timers/timers-howto.txt
timer: Added usleep_range timer
Revert "timer: Added usleep[_range] timer"
clockevents: Remove the per cpu tick skew
posix_timer: Move copy_to_user(created_timer_id) down in timer_create()
timer: Added usleep[_range] timer
timers: Document meaning of deferrable timer
Diffstat (limited to 'kernel')
-rw-r--r-- | kernel/posix-timers.c | 11 | ||||
-rw-r--r-- | kernel/time/tick-sched.c | 5 | ||||
-rw-r--r-- | kernel/timer.c | 31 |
3 files changed, 35 insertions, 12 deletions
diff --git a/kernel/posix-timers.c b/kernel/posix-timers.c index ad723420acc3..9ca4973f736d 100644 --- a/kernel/posix-timers.c +++ b/kernel/posix-timers.c | |||
@@ -560,11 +560,6 @@ SYSCALL_DEFINE3(timer_create, const clockid_t, which_clock, | |||
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 | 562 | ||
563 | if (copy_to_user(created_timer_id, | ||
564 | &new_timer_id, sizeof (new_timer_id))) { | ||
565 | error = -EFAULT; | ||
566 | goto out; | ||
567 | } | ||
568 | if (timer_event_spec) { | 563 | if (timer_event_spec) { |
569 | if (copy_from_user(&event, timer_event_spec, sizeof (event))) { | 564 | if (copy_from_user(&event, timer_event_spec, sizeof (event))) { |
570 | error = -EFAULT; | 565 | error = -EFAULT; |
@@ -590,6 +585,12 @@ SYSCALL_DEFINE3(timer_create, const clockid_t, which_clock, | |||
590 | new_timer->sigq->info.si_tid = new_timer->it_id; | 585 | new_timer->sigq->info.si_tid = new_timer->it_id; |
591 | new_timer->sigq->info.si_code = SI_TIMER; | 586 | new_timer->sigq->info.si_code = SI_TIMER; |
592 | 587 | ||
588 | if (copy_to_user(created_timer_id, | ||
589 | &new_timer_id, sizeof (new_timer_id))) { | ||
590 | error = -EFAULT; | ||
591 | goto out; | ||
592 | } | ||
593 | |||
593 | error = CLOCK_DISPATCH(which_clock, timer_create, (new_timer)); | 594 | error = CLOCK_DISPATCH(which_clock, timer_create, (new_timer)); |
594 | if (error) | 595 | if (error) |
595 | goto out; | 596 | goto out; |
diff --git a/kernel/time/tick-sched.c b/kernel/time/tick-sched.c index 021d2f878f19..3e216e01bbd1 100644 --- a/kernel/time/tick-sched.c +++ b/kernel/time/tick-sched.c | |||
@@ -774,7 +774,6 @@ void tick_setup_sched_timer(void) | |||
774 | { | 774 | { |
775 | struct tick_sched *ts = &__get_cpu_var(tick_cpu_sched); | 775 | struct tick_sched *ts = &__get_cpu_var(tick_cpu_sched); |
776 | ktime_t now = ktime_get(); | 776 | ktime_t now = ktime_get(); |
777 | u64 offset; | ||
778 | 777 | ||
779 | /* | 778 | /* |
780 | * Emulate tick processing via per-CPU hrtimers: | 779 | * Emulate tick processing via per-CPU hrtimers: |
@@ -784,10 +783,6 @@ void tick_setup_sched_timer(void) | |||
784 | 783 | ||
785 | /* Get the next period (per cpu) */ | 784 | /* Get the next period (per cpu) */ |
786 | hrtimer_set_expires(&ts->sched_timer, tick_init_jiffy_update()); | 785 | hrtimer_set_expires(&ts->sched_timer, tick_init_jiffy_update()); |
787 | offset = ktime_to_ns(tick_period) >> 1; | ||
788 | do_div(offset, num_possible_cpus()); | ||
789 | offset *= smp_processor_id(); | ||
790 | hrtimer_add_expires_ns(&ts->sched_timer, offset); | ||
791 | 786 | ||
792 | for (;;) { | 787 | for (;;) { |
793 | hrtimer_forward(&ts->sched_timer, now, tick_period); | 788 | hrtimer_forward(&ts->sched_timer, now, tick_period); |
diff --git a/kernel/timer.c b/kernel/timer.c index d61d16da0b64..f1b8afe1ad86 100644 --- a/kernel/timer.c +++ b/kernel/timer.c | |||
@@ -90,8 +90,13 @@ static DEFINE_PER_CPU(struct tvec_base *, tvec_bases) = &boot_tvec_bases; | |||
90 | 90 | ||
91 | /* | 91 | /* |
92 | * Note that all tvec_bases are 2 byte aligned and lower bit of | 92 | * Note that all tvec_bases are 2 byte aligned and lower bit of |
93 | * base in timer_list is guaranteed to be zero. Use the LSB for | 93 | * base in timer_list is guaranteed to be zero. Use the LSB to |
94 | * the new flag to indicate whether the timer is deferrable | 94 | * indicate whether the timer is deferrable. |
95 | * | ||
96 | * A deferrable timer will work normally when the system is busy, but | ||
97 | * will not cause a CPU to come out of idle just to service it; instead, | ||
98 | * the timer will be serviced when the CPU eventually wakes up with a | ||
99 | * subsequent non-deferrable timer. | ||
95 | */ | 100 | */ |
96 | #define TBASE_DEFERRABLE_FLAG (0x1) | 101 | #define TBASE_DEFERRABLE_FLAG (0x1) |
97 | 102 | ||
@@ -1758,3 +1763,25 @@ unsigned long msleep_interruptible(unsigned int msecs) | |||
1758 | } | 1763 | } |
1759 | 1764 | ||
1760 | EXPORT_SYMBOL(msleep_interruptible); | 1765 | EXPORT_SYMBOL(msleep_interruptible); |
1766 | |||
1767 | static int __sched do_usleep_range(unsigned long min, unsigned long max) | ||
1768 | { | ||
1769 | ktime_t kmin; | ||
1770 | unsigned long delta; | ||
1771 | |||
1772 | kmin = ktime_set(0, min * NSEC_PER_USEC); | ||
1773 | delta = (max - min) * NSEC_PER_USEC; | ||
1774 | return schedule_hrtimeout_range(&kmin, delta, HRTIMER_MODE_REL); | ||
1775 | } | ||
1776 | |||
1777 | /** | ||
1778 | * usleep_range - Drop in replacement for udelay where wakeup is flexible | ||
1779 | * @min: Minimum time in usecs to sleep | ||
1780 | * @max: Maximum time in usecs to sleep | ||
1781 | */ | ||
1782 | void usleep_range(unsigned long min, unsigned long max) | ||
1783 | { | ||
1784 | __set_current_state(TASK_UNINTERRUPTIBLE); | ||
1785 | do_usleep_range(min, max); | ||
1786 | } | ||
1787 | EXPORT_SYMBOL(usleep_range); | ||