On Thu, Apr 07, 2022 at 02:52:20PM +0200, Jiri Olsa wrote: > hi, > sending additional fix for symbol resolving in kprobe multi link > requested by Alexei and Andrii [1]. > > This speeds up bpftrace kprobe attachment, when using pure symbols > (3344 symbols) to attach: > > Before: > > # perf stat -r 5 -e cycles ./src/bpftrace -e 'kprobe:x* { } i:ms:1 { exit(); }' > ... > 6.5681 +- 0.0225 seconds time elapsed ( +- 0.34% ) > > After: > > # perf stat -r 5 -e cycles ./src/bpftrace -e 'kprobe:x* { } i:ms:1 { exit(); }' > ... > 0.5661 +- 0.0275 seconds time elapsed ( +- 4.85% ) > > > There are 2 reasons I'm sending this as RFC though.. > > - I added test that meassures attachment speed on all possible functions > from available_filter_functions, which is 48712 functions on my setup. > The attach/detach speed for that is under 2 seconds and the test will > fail if it's bigger than that.. which might fail on different setups > or loaded machine.. I'm not sure what's the best solution yet, separate > bench application perhaps? are you saying there is a bug in the code that you're still debugging? or just worried about time? I think it's better for it to be a part of selftest. CI will take extra 2 seconds to run. That's fine. It's a good stress test. > - copy_user_syms function potentially allocates lot of memory (~6MB in my > tests with attaching ~48k functions). I haven't seen this to fail yet, > but it might need to be changed to allocate memory gradually if needed, > do we care? ;-) replied in the other email. Thanks for working on this!