Repository navigation
Conversation
- arm_phdr_cb is called too many (over 10K) in tizen sample applications. It is called when the applications uses reflection assembly load. - Found proc informations are the same in the most cases. (libcoreclr.so) - The patch caches a proc info, then reuse it. It improves launching time of tizen sample applications about 1~2%
|
I found overhead in arm_phdr_cb. This patch reduces overhead using a cache. |
|
What is the exact method/callstack where you see this overhead? There are more effective ways how to make stackwalks faster. |
|
The change looks fine to me otherwise, but it means we have to make sure to keep it every time we update libunwind. |
|
Thanks for your comment. I also concerned about that, but I cannot find a better way. These are two call stacks when arm_phdr_cb is called. (arm_find_proc_info has a callsite to arm_phdr_cb) |
We should convert AssemblyNative::Load to QCall. It will get rid of the libunwind in this stacktrace and make things even faster than this fix. https://github.com/dotnet/runtime/blob/master/docs/design/coreclr/botr/mscorlib.md is a doc about FCalls/QCalls. Do you want to give it a shot to convert it?
This patch is CoreCLR specific. It does not make sense to upstream it. |
|
@jkotas Thank you so much. |
|
If we can get the same or better gain using the change @jkotas has suggested (turn AssemblyNative::Load into QCall), I would prefer doing that instead of diverging from the official libunwind. |
|
However, it seems that making this change upstream in libunwind may still make sense. @jkotas, this basically caches the range of a whole PT_LOAD segment in the elf file, so it seems it would speed up unwinding in general when exception is propagated through the same PT_LOAD segment. For example, in libcoreclr.so, there are two PT_LOAD segments where only the first one contains all the libcoreclr.so executable code. The second one contains .tbss (TLS stuff) and the .data.rel.ro sections. |
Maybe. It is something to discuss with libunwind maintainers.
Yes, it caches the range for the one elf file that contains libunwind itself. I am not sure how many other libunwind uses would benefit from this cache. For example, I do not think it would help with the issues explained in libunwind/libunwind#16 |
Ah, I've misread the change and it seemed to me that it caches the last elf file encountered during the unwind, not just the one containing the libunwind. That was what I've considered as usable for everyone. If done that way, it would recompute the cached value only when crossing boundary between two elf files. |
|
I measured another approach that @janvorli mentioned (caches the last elf file). |
|
Converting to QCall Thank you. |
It is called when the applications uses reflection assembly load.
It improves launching time of tizen sample applications about 1~2%