Need help to understand TLS behavior

David Holmes david.holmes at oracle.com
Wed Dec 16 05:35:54 UTC 2015


On 16/12/2015 6:23 AM, Martin Buchholz wrote:
> On Mon, Dec 14, 2015 at 8:44 PM, David Holmes <david.holmes at oracle.com> wrote:
>> On 15/12/2015 6:53 AM, Martin Buchholz wrote:
>>>
>>> Thread local storage is trouble.
>>>
>>> java stack sizes should be in _addition_ to any OS overhead, which
>>> includes TLS.
>>
>>
>> TLS shouldn't be coming out the stack of the thread AFAIK - I see nothing
>> about that in "ELF Handling for Thread Local Storage". That is why I want to
>> know more about the test, the compilation environment and the execution
>> environment.
>
> I have also struggled to understand "ELF Handling for Thread Local Storage".
>
>> Do you mean that the value specified at the Java level should be rounded up
>> to accommodate guard pages etc at the native level?
>
> Yes, I think so. All of the -Xss size should be available for actual
> stack frames.

Alas no nice way to know what that value should be. I cringe at taking 
the same approach that Rust had to do.

It's kind of interesting we've never hit this before. It's very 
frustrating that we hit it on a thread that couldn't care less about the 
TLS variables that have claimed space on its stack. I guess they need a 
notion of "inheritable thread-locals" too.

David



More information about the core-libs-dev mailing list