Messages in this thread | | | Date | Mon, 17 Jun 2013 15:48:05 +0200 | From | Oleg Nesterov <> | Subject | Re: [PATCH 1/3] tracing/kprobes: Avoid perf_trace_buf_*() if ->perf_events is empty |
| |
On 06/17, zhangwei(Jovi) wrote: > > On 2013/6/17 1:21, Oleg Nesterov wrote: > > perf_trace_buf_prepare() + perf_trace_buf_submit() make no sense > > if this task/CPU has no active counters. Change kprobe_perf_func() > > and kretprobe_perf_func() to check call->perf_events beforehand > > and return if this list is empty. > > > > For example, "perf record -e some_probe -p1". Only /sbin/init will > > report, all other threads which hit the same probe will do > > perf_trace_buf_prepare/perf_trace_buf_submit just to realize that > > nobody wants perf_swevent_event(). > > > > Signed-off-by: Oleg Nesterov <oleg@redhat.com> > > Good point, I think we also need to change other places in below patch. > > After applied the patch, perf_tp_event() function call reduced a lots > when using task based perf tracing.
Yes, I was going to do this, but this is not that simple.
> --- a/include/trace/ftrace.h > +++ b/include/trace/ftrace.h > @@ -659,6 +659,10 @@ perf_trace_##call(void *__data, proto) \ > int __data_size; \ > int rctx; \ > \ > + head = this_cpu_ptr(event_call->perf_events); \ > + if (hlist_empty(head)) \ > + return; \ > + \
This is not right. Please note __perf_task() and "if (task && task != current)" in perf_tp_event().
Oleg.
| |