[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-Id: <1302296275-26767-1-git-send-email-fweisbec@gmail.com>
Date: Fri, 8 Apr 2011 22:57:55 +0200
From: Frederic Weisbecker <fweisbec@...il.com>
To: Peter Zijlstra <a.p.zijlstra@...llo.nl>
Cc: LKML <linux-kernel@...r.kernel.org>,
Frederic Weisbecker <fweisbec@...il.com>,
Ingo Molnar <mingo@...e.hu>,
Peter Zijlstra <a.p.zijlstra@...llo.nl>,
Arnaldo Carvalho de Melo <acme@...hat.com>,
Paul Mackerras <paulus@...ba.org>,
Stephane Eranian <eranian@...gle.com>
Subject: [PATCH] perf: Don't schedule tracepoints when exclude_kernel is set
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@...il.com>
Cc: Ingo Molnar <mingo@...e.hu>
Cc: Peter Zijlstra <a.p.zijlstra@...llo.nl>
Cc: Arnaldo Carvalho de Melo <acme@...hat.com>
Cc: Paul Mackerras <paulus@...ba.org>
Cc: Stephane Eranian <eranian@...gle.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
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists