Skip to content

Commit

Permalink
tracing/function: Avoid perf_trace_buf_*() if event_function.perf_eve…
Browse files Browse the repository at this point in the history
…nts is empty

perf_trace_buf_prepare() + perf_trace_buf_submit(head, task => NULL)
make no sense if hlist_empty(head). Change perf_ftrace_function_call()
to check event_function.perf_events beforehand.

Link: http://lkml.kernel.org/r/[email protected]

Acked-by: Peter Zijlstra <[email protected]>
Signed-off-by: Oleg Nesterov <[email protected]>
Signed-off-by: Steven Rostedt <[email protected]>
  • Loading branch information
oleg-nesterov authored and rostedt committed Jul 19, 2013
1 parent d611851 commit b8ebfd3
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions kernel/trace/trace_event_perf.c
Original file line number Diff line number Diff line change
Expand Up @@ -266,6 +266,10 @@ perf_ftrace_function_call(unsigned long ip, unsigned long parent_ip,
struct pt_regs regs;
int rctx;

head = this_cpu_ptr(event_function.perf_events);
if (hlist_empty(head))
return;

#define ENTRY_SIZE (ALIGN(sizeof(struct ftrace_entry) + sizeof(u32), \
sizeof(u64)) - sizeof(u32))

Expand All @@ -279,8 +283,6 @@ perf_ftrace_function_call(unsigned long ip, unsigned long parent_ip,

entry->ip = ip;
entry->parent_ip = parent_ip;

head = this_cpu_ptr(event_function.perf_events);
perf_trace_buf_submit(entry, ENTRY_SIZE, rctx, 0,
1, &regs, head, NULL);

Expand Down

0 comments on commit b8ebfd3

Please sign in to comment.