lkml.org 
[lkml]   [2011]   [Apr]   [8]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
From
Subject[PATCH] perf: Don't schedule tracepoints when exclude_kernel is set
Date
Instead of checking attr.exclude_kernel anytime a tracepoint
event triggers, simply don't schedule the tracepoint it that
attribute is set. This makes one test less in the tracing
path.

Signed-off-by: Frederic Weisbecker <fweisbec@gmail.com>
Cc: Ingo Molnar <mingo@elte.hu>
Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>
Cc: Arnaldo Carvalho de Melo <acme@redhat.com>
Cc: Paul Mackerras <paulus@samba.org>
Cc: Stephane Eranian <eranian@google.com>
---
kernel/perf_event.c | 5 -----
kernel/trace/trace_event_perf.c | 6 +++++-
2 files changed, 5 insertions(+), 6 deletions(-)
diff --git a/kernel/perf_event.c b/kernel/perf_event.c
index c75925c..2f3fb90 100644
--- a/kernel/perf_event.c
+++ b/kernel/perf_event.c
@@ -5491,11 +5491,6 @@ static int perf_tp_event_match(struct perf_event *event,
{
if (event->hw.state & PERF_HES_STOPPED)
return 0;
- /*
- * All tracepoints are from kernel-space.
- */
- if (event->attr.exclude_kernel)
- return 0;

if (!perf_tp_filter_match(event, data))
return 0;
diff --git a/kernel/trace/trace_event_perf.c b/kernel/trace/trace_event_perf.c
index 19a359d..427314b 100644
--- a/kernel/trace/trace_event_perf.c
+++ b/kernel/trace/trace_event_perf.c
@@ -136,6 +136,10 @@ int perf_trace_add(struct perf_event *p_event, int flags)
struct hlist_head __percpu *pcpu_list;
struct hlist_head *list;

+ /* Tracepoints always trigger in the kernel */
+ if (p_event->attr.exclude_kernel)
+ return 0;
+
pcpu_list = tp_event->perf_events;
if (WARN_ON_ONCE(!pcpu_list))
return -EINVAL;
@@ -151,7 +155,7 @@ int perf_trace_add(struct perf_event *p_event, int flags)

void perf_trace_del(struct perf_event *p_event, int flags)
{
- hlist_del_rcu(&p_event->hlist_entry);
+ hlist_del_init_rcu(&p_event->hlist_entry);
}

void perf_trace_destroy(struct perf_event *p_event)
--
1.7.3.2


\
 
 \ /
  Last update: 2011-04-08 23:01    [from the cache]
©2003-2011 Jasper Spaans