[PATCH 10/10] perf: Optimize perf_tp_event_match

Peter Zijlstra
2010-05-21T09:11:25Z

[-- Attachment #1: perf-opt-exl.patch --]
[-- Type: text/plain, Size: 751 bytes --]

Since we know tracepoints come from kernel context, avoid conditionals
that try and establish that very fact.

Signed-off-by: Peter Zijlstra <a.p.zijlstra@chello.nl>
---
kernel/perf_event.c | 7 +++++--
1 file changed, 5 insertions(+), 2 deletions(-)

Index: linux-2.6/kernel/perf_event.c
===================================================================
--- linux-2.6.orig/kernel/perf_event.c
+++ linux-2.6/kernel/perf_event.c
@@ -4477,7 +4477,10 @@ static int perf_tp_event_match(struct pe
struct perf_sample_data *data,
struct pt_regs *regs)
{
- if (perf_exclude_event(event, regs))
+ /*
+ * All tracepoints are from kernel-space.
+ */
+ if (event->attr.exclude_kernel)
return 0;

if (!perf_tp_filter_match(event, data))