Messages in this thread | | | Date | Thu, 11 Apr 2013 13:59:21 +0200 | From | Oleg Nesterov <> | Subject | Re: [PATCH 0/1] uprobes/tracing: Don't pass addr=ip to perf_trace_buf_submit() |
| |
On 04/11, Masami Hiramatsu wrote: > > (2013/04/10 23:58), Oleg Nesterov wrote: > > > And... Cough, another question ;) To simplify, lets discuss kprobe_perf_func() > > only. Suppose that a task hits the kprobe but this task/cpu doesn't have > > a counter. Can't we avoid perf_trace_buf_prepare/submit in this case? > > IOW, what do you think about the change below? > > Hmm, I'm not so sure how frequently this happens.
Suppose that you do, say, "perf record -e probe:some_func workload". Only "workload" will have the active counter, any other task which hits the probed some_func() will do perf_trace_buf_prepare/perf_trace_buf_submit just to realize that nobody wants perf_swevent_event().
Simple test-case:
#include <unistd.h>
int main(void) { int n;
for (n = 0; n < 1000 * 1000; ++n) getppid();
return 0; }
Without kprobe:
# time ./ppid
real 0m0.663s user 0m0.163s sys 0m0.500s
Activate the probe:
# perf probe sys_getppid
# perf record -e probe:sys_getppid sleep 1000 & [1] 546
Test it again 3 times:
# time ./ppid
Before the patch:
real 0m9.727s user 0m0.177s sys 0m9.547s
real 0m9.752s user 0m0.180s sys 0m9.573s
real 0m9.761s user 0m0.187s sys 0m9.573s
After the patch:
real 0m9.605s user 0m0.163s sys 0m9.437s
real 0m9.592s user 0m0.167s sys 0m9.423s
real 0m9.613s user 0m0.183s sys 0m9.427s
So the difference looks measurable but small, and I did the testing under qemu so I do not really know if we can trust the numbers.
> And, is this right way to > handle that case?
If only I was sure ;) I am asking.
And, to clarify, it is not that I think this change can really improve the perfomance. Just I am trying to understand what I have missed.
> If so, we can do same thing also on trace_events. > (perf_trace_##call in include/trace/ftrace.h)
Yes, yes, this is not kprobe-specific. It seems that more users of perf_trace_buf_submit() could be changed the same way.
Thanks,
Oleg.
| |