diff options
| author | Peter Zijlstra <a.p.zijlstra@chello.nl> | 2010-05-20 13:50:07 -0400 |
|---|---|---|
| committer | Ingo Molnar <mingo@elte.hu> | 2010-05-21 05:37:59 -0400 |
| commit | a94ffaaf55552769af328eaca9260fe6291c66c7 (patch) | |
| tree | 39339b21a962b50c6f8be09786fcb41cdc4a8459 /kernel | |
| parent | 3cafa9fbb5c1d564b7b8e7224f493effbf04ffee (diff) | |
perf: Remove more code from the fastpath
Sanity checks cost instructions.
Signed-off-by: Peter Zijlstra <a.p.zijlstra@chello.nl>
Cc: Arnaldo Carvalho de Melo <acme@redhat.com>
Cc: Frederic Weisbecker <fweisbec@gmail.com>
Cc: Paul Mackerras <paulus@samba.org>
Cc: Mike Galbraith <efault@gmx.de>
Cc: Steven Rostedt <rostedt@goodmis.org>
LKML-Reference: <20100521090710.852926930@chello.nl>
Signed-off-by: Ingo Molnar <mingo@elte.hu>
Diffstat (limited to 'kernel')
| -rw-r--r-- | kernel/perf_event.c | 20 |
1 files changed, 4 insertions, 16 deletions
diff --git a/kernel/perf_event.c b/kernel/perf_event.c index 953ce46d7b2f..d25c864cadbf 100644 --- a/kernel/perf_event.c +++ b/kernel/perf_event.c | |||
| @@ -2967,20 +2967,11 @@ again: | |||
| 2967 | preempt_enable(); | 2967 | preempt_enable(); |
| 2968 | } | 2968 | } |
| 2969 | 2969 | ||
| 2970 | void perf_output_copy(struct perf_output_handle *handle, | 2970 | __always_inline void perf_output_copy(struct perf_output_handle *handle, |
| 2971 | const void *buf, unsigned int len) | 2971 | const void *buf, unsigned int len) |
| 2972 | { | 2972 | { |
| 2973 | handle->offset += len; | ||
| 2974 | |||
| 2975 | /* | ||
| 2976 | * Check we didn't copy past our reservation window, taking the | ||
| 2977 | * possible unsigned int wrap into account. | ||
| 2978 | */ | ||
| 2979 | if (WARN_ON_ONCE(((long)(handle->head - handle->offset)) < 0)) | ||
| 2980 | return; | ||
| 2981 | |||
| 2982 | do { | 2973 | do { |
| 2983 | unsigned long size = min(handle->size, len); | 2974 | unsigned long size = min_t(unsigned long, handle->size, len); |
| 2984 | 2975 | ||
| 2985 | memcpy(handle->addr, buf, size); | 2976 | memcpy(handle->addr, buf, size); |
| 2986 | 2977 | ||
| @@ -3055,15 +3046,12 @@ int perf_output_begin(struct perf_output_handle *handle, | |||
| 3055 | goto fail; | 3046 | goto fail; |
| 3056 | } while (local_cmpxchg(&data->head, offset, head) != offset); | 3047 | } while (local_cmpxchg(&data->head, offset, head) != offset); |
| 3057 | 3048 | ||
| 3058 | handle->offset = offset; | ||
| 3059 | handle->head = head; | ||
| 3060 | |||
| 3061 | if (head - local_read(&data->wakeup) > data->watermark) | 3049 | if (head - local_read(&data->wakeup) > data->watermark) |
| 3062 | local_add(data->watermark, &data->wakeup); | 3050 | local_add(data->watermark, &data->wakeup); |
| 3063 | 3051 | ||
| 3064 | handle->page = handle->offset >> (PAGE_SHIFT + page_order(data)); | 3052 | handle->page = offset >> (PAGE_SHIFT + page_order(data)); |
| 3065 | handle->page &= data->nr_pages - 1; | 3053 | handle->page &= data->nr_pages - 1; |
| 3066 | handle->size = handle->offset & ((PAGE_SIZE << page_order(data)) - 1); | 3054 | handle->size = offset & ((PAGE_SIZE << page_order(data)) - 1); |
| 3067 | handle->addr = data->data_pages[handle->page]; | 3055 | handle->addr = data->data_pages[handle->page]; |
| 3068 | handle->addr += handle->size; | 3056 | handle->addr += handle->size; |
| 3069 | handle->size = (PAGE_SIZE << page_order(data)) - handle->size; | 3057 | handle->size = (PAGE_SIZE << page_order(data)) - handle->size; |
