pthread_exit behavior from main

Carlos O'Donell carlos@systemhalted.org
Fri Oct 5 02:30:00 GMT 2012


On Thu, Oct 4, 2012 at 10:15 PM, Siddhesh Poyarekar
<siddhesh.poyarekar@gmail.com> wrote:
> (Sorry, accidentally did a Reply instead of Reply All)
>
> On 5 October 2012 07:11, Godmar Back <godmar@gmail.com> wrote:
>> Just out of curiosity, why do you madvise it with MADV_DONTNEED rather
>> than munmapping it outright?
>
> That's a performance tweak.  The pthread library caches a specific
> number of stacks so that they can be reused by new threads, thus
> avoiding the need for repeated syscalls.

Right, I'd forgotten all about that.

When we hit the 40MB static limit in allocatestate we call __free_stacks
which *does* call munmap for the stack.

Cheers,
Carlos.



More information about the Libc-help mailing list