Need help to understand TLS behavior

Jeremy Manson jeremymanson at google.com
Tue Dec 15 22:03:04 UTC 2015


On Mon, Dec 14, 2015 at 11:25 PM, David Holmes <david.holmes at oracle.com>
wrote:

> On 15/12/2015 4:32 PM, Jeremy Manson wrote:
>
>> David: What the spec says and what glibc does are two different things:
>>
>> https://sourceware.org/bugzilla/show_bug.cgi?id=11787
>>
>> We have an internal Google patch to compensate for this.  Nasty stuff.
>>
>
> Nasty isn't even the right word - this is just ludicrous! And the bug has
> just languished even though they were going to fix it years ago!!!!! And I
> also cried when I saw the part finally recognizing that glibc does the
> wrong thing by taking the guard pages from the requested stack size!
>
> To me this just screams don't use TLS on linux except for trivially small
> data structures, or else use static-TLS.
>
> Which brings me back to this test - make the variable static!
>
> Thanks Jeremy. I'm thoroughly depressed now.
>

Happy to oblige.  :)

The really depressing part is that there is no standard way of figuring out
how much TLS you need so that you can compensate.  Note that the Rust
people are trying to introspect into glibc to figure it out.  We roll our
own glibc, so at least we can export something that we guarantee can work.
You would probably want to avoid both of these situations for the JDK.

I expect the official answer from you guys about this is going to end up
being "bump your Xss if you really care", which is deeply sad.

Jeremy



More information about the core-libs-dev mailing list