[lldb-dev] Parallelize loading of shared libraries
Scott Smith via lldb-dev
lldb-dev at lists.llvm.org
Wed Apr 12 22:34:23 PDT 2017
The POSIX dynamic loader processes one module at a time. If you have a lot
of shared libraries, each with a lot of symbols, this creates unneeded
serialization (despite the use of TaskRunners during symbol loading, there
is still quite a bit of serialization when loading a library).
In order to parallelize this, I actually had to do two things. Neither one
makes any difference, only the combination improves performance (I left
them as separate patches for clarity):
1. Change the POSIX dynamic loader to fork each module into its own
thread. I didn't use TaskRunner because some of the called functions use
TaskRunner, and it isn't recursion safe. The final modules are added to
the list in the original order despite whatever order the threads finish.
2. Change Module::AppendImpl to fire off some expensive work as a separate
thread.
These two changes bring startup time down from 36 (assuming the previously
mentioned crc changes) seconds to 11. It doesn't improve efficiency, it
just increases parallelism.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/lldb-dev/attachments/20170412/31d4c15a/attachment-0001.html>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: dyn_load_thread.patch
Type: application/octet-stream
Size: 1739 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/lldb-dev/attachments/20170412/31d4c15a/attachment-0002.obj>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: prime_caches.patch
Type: application/octet-stream
Size: 6243 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/lldb-dev/attachments/20170412/31d4c15a/attachment-0003.obj>
More information about the lldb-dev
mailing list