reducing the contention in dl_iterate_phdr

Thomas Neumann tneumann@users.sourceforge.net
Sat May 16 10:47:49 GMT 2020


> I still think that an explicit function to perform the lookup on
> behalf of libgcc_s is the right direction.

but that means moving quite a bit of libgcc into glibc. At least the
logic called from _Unwind_IteratePhdrCallback. And to make this
efficient in the presence of JITed code, you would have to include parts
of unwind-dw2-fde.c, too, such that manually registered unwind frames
can be processed with the same framework.

An alternative would be to offer a new dl_iterate_phdr variant
(tentatively called dl_iterate_phdr_read) to takes just the read lock,
while the existing dl_iterate_phdr continues to take the lock in
exclusive mode. That would allow libgcc to opt-in to an interface with
less contention. Of course that would require changes to libgcc, too, to
make their cache thread safe, but it would not break existing programs.

For an even better implementation I think it would be good if glibc had
an interface for callbacks that are called after every dlopen and
dclose. Because that would allow libgcc to build an index over the
lookup tables. But that is a much more invasive change.

Thomas


More information about the Libc-help mailing list