diff options
Diffstat (limited to 'kernel')
| -rw-r--r-- | kernel/hrtimer.c | 2 | ||||
| -rw-r--r-- | kernel/perf_event.c | 40 | ||||
| -rw-r--r-- | kernel/posix-timers.c | 11 | ||||
| -rw-r--r-- | kernel/timer.c | 10 |
4 files changed, 34 insertions, 29 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/perf_event.c b/kernel/perf_event.c index e099650cd249..bd7ce8ca5bb9 100644 --- a/kernel/perf_event.c +++ b/kernel/perf_event.c | |||
| @@ -4999,8 +4999,8 @@ SYSCALL_DEFINE5(perf_event_open, | |||
| 4999 | struct perf_event_context *ctx; | 4999 | struct perf_event_context *ctx; |
| 5000 | struct file *event_file = NULL; | 5000 | struct file *event_file = NULL; |
| 5001 | struct file *group_file = NULL; | 5001 | struct file *group_file = NULL; |
| 5002 | int event_fd; | ||
| 5002 | int fput_needed = 0; | 5003 | int fput_needed = 0; |
| 5003 | int fput_needed2 = 0; | ||
| 5004 | int err; | 5004 | int err; |
| 5005 | 5005 | ||
| 5006 | /* for future expandability... */ | 5006 | /* for future expandability... */ |
| @@ -5021,12 +5021,18 @@ SYSCALL_DEFINE5(perf_event_open, | |||
| 5021 | return -EINVAL; | 5021 | return -EINVAL; |
| 5022 | } | 5022 | } |
| 5023 | 5023 | ||
| 5024 | event_fd = get_unused_fd_flags(O_RDWR); | ||
| 5025 | if (event_fd < 0) | ||
| 5026 | return event_fd; | ||
| 5027 | |||
| 5024 | /* | 5028 | /* |
| 5025 | * Get the target context (task or percpu): | 5029 | * Get the target context (task or percpu): |
| 5026 | */ | 5030 | */ |
| 5027 | ctx = find_get_context(pid, cpu); | 5031 | ctx = find_get_context(pid, cpu); |
| 5028 | if (IS_ERR(ctx)) | 5032 | if (IS_ERR(ctx)) { |
| 5029 | return PTR_ERR(ctx); | 5033 | err = PTR_ERR(ctx); |
| 5034 | goto err_fd; | ||
| 5035 | } | ||
| 5030 | 5036 | ||
| 5031 | /* | 5037 | /* |
| 5032 | * Look up the group leader (we will attach this event to it): | 5038 | * Look up the group leader (we will attach this event to it): |
| @@ -5066,13 +5072,11 @@ SYSCALL_DEFINE5(perf_event_open, | |||
| 5066 | if (IS_ERR(event)) | 5072 | if (IS_ERR(event)) |
| 5067 | goto err_put_context; | 5073 | goto err_put_context; |
| 5068 | 5074 | ||
| 5069 | err = anon_inode_getfd("[perf_event]", &perf_fops, event, O_RDWR); | 5075 | event_file = anon_inode_getfile("[perf_event]", &perf_fops, event, O_RDWR); |
| 5070 | if (err < 0) | 5076 | if (IS_ERR(event_file)) { |
| 5071 | goto err_free_put_context; | 5077 | err = PTR_ERR(event_file); |
| 5072 | |||
| 5073 | event_file = fget_light(err, &fput_needed2); | ||
| 5074 | if (!event_file) | ||
| 5075 | goto err_free_put_context; | 5078 | goto err_free_put_context; |
| 5079 | } | ||
| 5076 | 5080 | ||
| 5077 | if (flags & PERF_FLAG_FD_OUTPUT) { | 5081 | if (flags & PERF_FLAG_FD_OUTPUT) { |
| 5078 | err = perf_event_set_output(event, group_fd); | 5082 | err = perf_event_set_output(event, group_fd); |
| @@ -5093,19 +5097,19 @@ SYSCALL_DEFINE5(perf_event_open, | |||
| 5093 | list_add_tail(&event->owner_entry, ¤t->perf_event_list); | 5097 | list_add_tail(&event->owner_entry, ¤t->perf_event_list); |
| 5094 | mutex_unlock(¤t->perf_event_mutex); | 5098 | mutex_unlock(¤t->perf_event_mutex); |
| 5095 | 5099 | ||
| 5096 | err_fput_free_put_context: | 5100 | fput_light(group_file, fput_needed); |
| 5097 | fput_light(event_file, fput_needed2); | 5101 | fd_install(event_fd, event_file); |
| 5102 | return event_fd; | ||
| 5098 | 5103 | ||
| 5104 | err_fput_free_put_context: | ||
| 5105 | fput(event_file); | ||
| 5099 | err_free_put_context: | 5106 | err_free_put_context: |
| 5100 | if (err < 0) | 5107 | free_event(event); |
| 5101 | free_event(event); | ||
| 5102 | |||
| 5103 | err_put_context: | 5108 | err_put_context: |
| 5104 | if (err < 0) | ||
| 5105 | put_ctx(ctx); | ||
| 5106 | |||
| 5107 | fput_light(group_file, fput_needed); | 5109 | fput_light(group_file, fput_needed); |
| 5108 | 5110 | put_ctx(ctx); | |
| 5111 | err_fd: | ||
| 5112 | put_unused_fd(event_fd); | ||
| 5109 | return err; | 5113 | return err; |
| 5110 | } | 5114 | } |
| 5111 | 5115 | ||
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; |
