aboutsummaryrefslogtreecommitdiffstats
path: root/kernel/trace
diff options
context:
space:
mode:
authorPeter Zijlstra <a.p.zijlstra@chello.nl>2010-05-18 12:08:32 -0400
committerIngo Molnar <mingo@elte.hu>2010-05-18 12:35:46 -0400
commit4f41c013f553957765902fb01475972f0af3e8e7 (patch)
treeddaa54947cc990094a4b270f2f8b3d6da195044f /kernel/trace
parentef4f30f54e265c2f6f9ac9eda4db158a4e16050b (diff)
perf/ftrace: Optimize perf/tracepoint interaction for single events
When we've got but a single event per tracepoint there is no reason to try and multiplex it so don't. Signed-off-by: Peter Zijlstra <a.p.zijlstra@chello.nl> Tested-by: Ingo Molnar <mingo@elte.hu> Cc: Steven Rostedt <rostedt@goodmis.org> Cc: Frederic Weisbecker <fweisbec@gmail.com> Cc: Mike Galbraith <efault@gmx.de> Cc: Paul Mackerras <paulus@samba.org> Cc: Arnaldo Carvalho de Melo <acme@redhat.com> LKML-Reference: <new-submission> Signed-off-by: Ingo Molnar <mingo@elte.hu>
Diffstat (limited to 'kernel/trace')
-rw-r--r--kernel/trace/trace_event_perf.c11
-rw-r--r--kernel/trace/trace_kprobe.c4
-rw-r--r--kernel/trace/trace_syscalls.c6
3 files changed, 13 insertions, 8 deletions
diff --git a/kernel/trace/trace_event_perf.c b/kernel/trace/trace_event_perf.c
index 0565bb42566f..89b780a7c522 100644
--- a/kernel/trace/trace_event_perf.c
+++ b/kernel/trace/trace_event_perf.c
@@ -27,13 +27,15 @@ typedef typeof(unsigned long [PERF_MAX_TRACE_SIZE / sizeof(unsigned long)])
27/* Count the events in use (per event id, not per instance) */ 27/* Count the events in use (per event id, not per instance) */
28static int total_ref_count; 28static int total_ref_count;
29 29
30static int perf_trace_event_enable(struct ftrace_event_call *event) 30static int perf_trace_event_enable(struct ftrace_event_call *event, void *data)
31{ 31{
32 char *buf; 32 char *buf;
33 int ret = -ENOMEM; 33 int ret = -ENOMEM;
34 34
35 if (event->perf_refcount++ > 0) 35 if (event->perf_refcount++ > 0) {
36 event->perf_data = NULL;
36 return 0; 37 return 0;
38 }
37 39
38 if (!total_ref_count) { 40 if (!total_ref_count) {
39 buf = (char *)alloc_percpu(perf_trace_t); 41 buf = (char *)alloc_percpu(perf_trace_t);
@@ -51,6 +53,7 @@ static int perf_trace_event_enable(struct ftrace_event_call *event)
51 53
52 ret = event->perf_event_enable(event); 54 ret = event->perf_event_enable(event);
53 if (!ret) { 55 if (!ret) {
56 event->perf_data = data;
54 total_ref_count++; 57 total_ref_count++;
55 return 0; 58 return 0;
56 } 59 }
@@ -68,7 +71,7 @@ fail_buf:
68 return ret; 71 return ret;
69} 72}
70 73
71int perf_trace_enable(int event_id) 74int perf_trace_enable(int event_id, void *data)
72{ 75{
73 struct ftrace_event_call *event; 76 struct ftrace_event_call *event;
74 int ret = -EINVAL; 77 int ret = -EINVAL;
@@ -77,7 +80,7 @@ int perf_trace_enable(int event_id)
77 list_for_each_entry(event, &ftrace_events, list) { 80 list_for_each_entry(event, &ftrace_events, list) {
78 if (event->id == event_id && event->perf_event_enable && 81 if (event->id == event_id && event->perf_event_enable &&
79 try_module_get(event->mod)) { 82 try_module_get(event->mod)) {
80 ret = perf_trace_event_enable(event); 83 ret = perf_trace_event_enable(event, data);
81 break; 84 break;
82 } 85 }
83 } 86 }
diff --git a/kernel/trace/trace_kprobe.c b/kernel/trace/trace_kprobe.c
index a7514326052b..2d7bf4146be8 100644
--- a/kernel/trace/trace_kprobe.c
+++ b/kernel/trace/trace_kprobe.c
@@ -1362,7 +1362,7 @@ static __kprobes void kprobe_perf_func(struct kprobe *kp,
1362 for (i = 0; i < tp->nr_args; i++) 1362 for (i = 0; i < tp->nr_args; i++)
1363 call_fetch(&tp->args[i].fetch, regs, data + tp->args[i].offset); 1363 call_fetch(&tp->args[i].fetch, regs, data + tp->args[i].offset);
1364 1364
1365 perf_trace_buf_submit(entry, size, rctx, entry->ip, 1, irq_flags, regs); 1365 perf_trace_buf_submit(entry, size, rctx, entry->ip, 1, irq_flags, regs, call->perf_data);
1366} 1366}
1367 1367
1368/* Kretprobe profile handler */ 1368/* Kretprobe profile handler */
@@ -1395,7 +1395,7 @@ static __kprobes void kretprobe_perf_func(struct kretprobe_instance *ri,
1395 call_fetch(&tp->args[i].fetch, regs, data + tp->args[i].offset); 1395 call_fetch(&tp->args[i].fetch, regs, data + tp->args[i].offset);
1396 1396
1397 perf_trace_buf_submit(entry, size, rctx, entry->ret_ip, 1, 1397 perf_trace_buf_submit(entry, size, rctx, entry->ret_ip, 1,
1398 irq_flags, regs); 1398 irq_flags, regs, call->perf_data);
1399} 1399}
1400 1400
1401static int probe_perf_enable(struct ftrace_event_call *call) 1401static int probe_perf_enable(struct ftrace_event_call *call)
diff --git a/kernel/trace/trace_syscalls.c b/kernel/trace/trace_syscalls.c
index 4d6d711717f2..9eff1a4b49b9 100644
--- a/kernel/trace/trace_syscalls.c
+++ b/kernel/trace/trace_syscalls.c
@@ -468,7 +468,8 @@ static void perf_syscall_enter(struct pt_regs *regs, long id)
468 rec->nr = syscall_nr; 468 rec->nr = syscall_nr;
469 syscall_get_arguments(current, regs, 0, sys_data->nb_args, 469 syscall_get_arguments(current, regs, 0, sys_data->nb_args,
470 (unsigned long *)&rec->args); 470 (unsigned long *)&rec->args);
471 perf_trace_buf_submit(rec, size, rctx, 0, 1, flags, regs); 471 perf_trace_buf_submit(rec, size, rctx, 0, 1, flags, regs,
472 sys_data->enter_event->perf_data);
472} 473}
473 474
474int perf_sysenter_enable(struct ftrace_event_call *call) 475int perf_sysenter_enable(struct ftrace_event_call *call)
@@ -543,7 +544,8 @@ static void perf_syscall_exit(struct pt_regs *regs, long ret)
543 rec->nr = syscall_nr; 544 rec->nr = syscall_nr;
544 rec->ret = syscall_get_return_value(current, regs); 545 rec->ret = syscall_get_return_value(current, regs);
545 546
546 perf_trace_buf_submit(rec, size, rctx, 0, 1, flags, regs); 547 perf_trace_buf_submit(rec, size, rctx, 0, 1, flags, regs,
548 sys_data->exit_event->perf_data);
547} 549}
548 550
549int perf_sysexit_enable(struct ftrace_event_call *call) 551int perf_sysexit_enable(struct ftrace_event_call *call)