Async-signal-safe access to __thread variables from dlopen()ed libraries?

Ondřej Bílka neleai@seznam.cz
Fri Sep 20 17:56:00 GMT 2013


On Fri, Sep 20, 2013 at 11:23:55AM -0300, Alexandre Oliva wrote:
> On Sep 18, 2013, Paul Pluzhnikov <ppluzhnikov@google.com> wrote:
> 
> > - introduces async-signal-safe mmap-based allocator into elf/dl-misc.c, and
> > - updates the rest of the loader to use this allocator when getting space
> >   for non-static TLS.
> 
> Why not make malloc AS-safe instead?  I've reviewed it, and having
> multiple arenas seems to make it not too hard to use an alternate arena
> if the primary arena for a thread happens to be already locked.  It's
> only if we have to create a new arena that we might get in trouble, but
> then, worst case, malloc itself can always fallback to mmapped
> allocation.
> 
> Wouldn't that be a more advantageous path to take?
> 
This would not help as users can LD_PRELOAD=custom_allocator to improve
performance by several percents.

For that you need loader allocations routed to different allocator than
default. That allocator could be based no current malloc but I do not
know if its better than simple allocator.



More information about the Libc-alpha mailing list