mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git
synced 2025-01-12 16:11:04 +00:00
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>
This commit is contained in:
parent
3cafa9fbb5
commit
a94ffaaf55
@ -803,8 +803,6 @@ struct perf_cpu_context {
|
|||||||
struct perf_output_handle {
|
struct perf_output_handle {
|
||||||
struct perf_event *event;
|
struct perf_event *event;
|
||||||
struct perf_mmap_data *data;
|
struct perf_mmap_data *data;
|
||||||
unsigned long head;
|
|
||||||
unsigned long offset;
|
|
||||||
unsigned long wakeup;
|
unsigned long wakeup;
|
||||||
unsigned long size;
|
unsigned long size;
|
||||||
void *addr;
|
void *addr;
|
||||||
|
@ -2967,20 +2967,11 @@ again:
|
|||||||
preempt_enable();
|
preempt_enable();
|
||||||
}
|
}
|
||||||
|
|
||||||
void perf_output_copy(struct perf_output_handle *handle,
|
__always_inline void perf_output_copy(struct perf_output_handle *handle,
|
||||||
const void *buf, unsigned int len)
|
const void *buf, unsigned int len)
|
||||||
{
|
{
|
||||||
handle->offset += len;
|
|
||||||
|
|
||||||
/*
|
|
||||||
* Check we didn't copy past our reservation window, taking the
|
|
||||||
* possible unsigned int wrap into account.
|
|
||||||
*/
|
|
||||||
if (WARN_ON_ONCE(((long)(handle->head - handle->offset)) < 0))
|
|
||||||
return;
|
|
||||||
|
|
||||||
do {
|
do {
|
||||||
unsigned long size = min(handle->size, len);
|
unsigned long size = min_t(unsigned long, handle->size, len);
|
||||||
|
|
||||||
memcpy(handle->addr, buf, size);
|
memcpy(handle->addr, buf, size);
|
||||||
|
|
||||||
@ -3055,15 +3046,12 @@ int perf_output_begin(struct perf_output_handle *handle,
|
|||||||
goto fail;
|
goto fail;
|
||||||
} while (local_cmpxchg(&data->head, offset, head) != offset);
|
} while (local_cmpxchg(&data->head, offset, head) != offset);
|
||||||
|
|
||||||
handle->offset = offset;
|
|
||||||
handle->head = head;
|
|
||||||
|
|
||||||
if (head - local_read(&data->wakeup) > data->watermark)
|
if (head - local_read(&data->wakeup) > data->watermark)
|
||||||
local_add(data->watermark, &data->wakeup);
|
local_add(data->watermark, &data->wakeup);
|
||||||
|
|
||||||
handle->page = handle->offset >> (PAGE_SHIFT + page_order(data));
|
handle->page = offset >> (PAGE_SHIFT + page_order(data));
|
||||||
handle->page &= data->nr_pages - 1;
|
handle->page &= data->nr_pages - 1;
|
||||||
handle->size = handle->offset & ((PAGE_SIZE << page_order(data)) - 1);
|
handle->size = offset & ((PAGE_SIZE << page_order(data)) - 1);
|
||||||
handle->addr = data->data_pages[handle->page];
|
handle->addr = data->data_pages[handle->page];
|
||||||
handle->addr += handle->size;
|
handle->addr += handle->size;
|
||||||
handle->size = (PAGE_SIZE << page_order(data)) - handle->size;
|
handle->size = (PAGE_SIZE << page_order(data)) - handle->size;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user