aboutsummaryrefslogtreecommitdiffstats
path: root/kernel
diff options
context:
space:
mode:
authorOleg Nesterov <oleg@redhat.com>2013-04-13 09:36:49 -0400
committerOleg Nesterov <oleg@redhat.com>2013-04-15 11:39:52 -0400
commit515619f209114697fabd21eed1623bfa69746815 (patch)
tree84655a5404fb290f8492f3f953f9e61007f7c3e2 /kernel
parent32520b2c695b23221751eb09360a6a3dd3105b52 (diff)
uprobes/perf: Avoid perf_trace_buf_prepare/submit if ->perf_events is empty
perf_trace_buf_prepare() + perf_trace_buf_submit() make no sense if this task/CPU has no active counters. Change uprobe_perf_print() to return if hlist_empty(call->perf_events). Note: this is not uprobe-specific, we can change other users too. Signed-off-by: Oleg Nesterov <oleg@redhat.com>
Diffstat (limited to 'kernel')
-rw-r--r--kernel/trace/trace_uprobe.c5
1 files changed, 4 insertions, 1 deletions
diff --git a/kernel/trace/trace_uprobe.c b/kernel/trace/trace_uprobe.c
index 37ccb72f0f3b..32494fb0ee64 100644
--- a/kernel/trace/trace_uprobe.c
+++ b/kernel/trace/trace_uprobe.c
@@ -820,6 +820,10 @@ static void uprobe_perf_print(struct trace_uprobe *tu,
820 return; 820 return;
821 821
822 preempt_disable(); 822 preempt_disable();
823 head = this_cpu_ptr(call->perf_events);
824 if (hlist_empty(head))
825 goto out;
826
823 entry = perf_trace_buf_prepare(size, call->event.type, regs, &rctx); 827 entry = perf_trace_buf_prepare(size, call->event.type, regs, &rctx);
824 if (!entry) 828 if (!entry)
825 goto out; 829 goto out;
@@ -836,7 +840,6 @@ static void uprobe_perf_print(struct trace_uprobe *tu,
836 for (i = 0; i < tu->nr_args; i++) 840 for (i = 0; i < tu->nr_args; i++)
837 call_fetch(&tu->args[i].fetch, regs, data + tu->args[i].offset); 841 call_fetch(&tu->args[i].fetch, regs, data + tu->args[i].offset);
838 842
839 head = this_cpu_ptr(call->perf_events);
840 perf_trace_buf_submit(entry, size, rctx, 0, 1, regs, head, NULL); 843 perf_trace_buf_submit(entry, size, rctx, 0, 1, regs, head, NULL);
841 out: 844 out:
842 preempt_enable(); 845 preempt_enable();