summaryrefslogtreecommitdiffstats
path: root/kernel/perf_event.c
diff options
context:
space:
mode:
authorPeter Zijlstra <a.p.zijlstra@chello.nl>2010-05-18 11:12:48 +0200
committerIngo Molnar <mingo@elte.hu>2010-05-18 18:35:49 +0200
commit6d1acfd5c6bfd5231c13a8f2858d7f2afbaa1b62 (patch)
treeabcfa95947cafc94c978a255b814472fe67cad22 /kernel/perf_event.c
parentfa5881514ef9c9bcb29319aad85cf2d8889d91f1 (diff)
perf: Optimize perf_output_*() by avoiding local_xchg()
Since the x86 XCHG ins implies LOCK, avoid the use by using a sequence count instead. Signed-off-by: Peter Zijlstra <a.p.zijlstra@chello.nl> LKML-Reference: <new-submission> Signed-off-by: Ingo Molnar <mingo@elte.hu>
Diffstat (limited to 'kernel/perf_event.c')
-rw-r--r--kernel/perf_event.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/kernel/perf_event.c b/kernel/perf_event.c
index 1f98c78c334..7e3bcf1a29f 100644
--- a/kernel/perf_event.c
+++ b/kernel/perf_event.c
@@ -2917,6 +2917,7 @@ static void perf_output_get_handle(struct perf_output_handle *handle)
preempt_disable();
local_inc(&data->nest);
+ handle->wakeup = local_read(&data->wakeup);
}
static void perf_output_put_handle(struct perf_output_handle *handle)
@@ -2950,7 +2951,7 @@ again:
goto again;
}
- if (local_xchg(&data->wakeup, 0))
+ if (handle->wakeup != local_read(&data->wakeup))
perf_output_wakeup(handle);
preempt_enable();