Review request 6983240: guarantee((Solaris::min_stack_allowed >= (StackYellowPages+StackRedPages...) wrong

David Holmes David.Holmes at oracle.com
Mon Oct 4 20:09:22 PDT 2010


 > but the manpage for thr_min_stack states:
 >
 >     thr_min_stack() will return the unsigned int  THR_MIN_STACK,
 >     which is the minimum-allowable size for a thread's stack.
 >
 >     In this implementation the default size for a  user-thread's
 >     stack   is   one   mega-byte.

Never trust a manpage! The actual value I see on my system is 4K.

But this makes me wonder how "fixed" THR_MIN_STACK is and whether that 
guarantee should revert back to the original code and simply set 
minstack_allowed to the maximum of those two values.

David

David Holmes said the following on 10/05/10 10:41:
> Hi Coleen,
> 
> In os_solaris.cpp this comment should now refer to 2*BytesPerWord
> 
>   // Add in BytesPerWord times page size to account for VM stack during
>   // class initialization depending on 32 or 64 bit VM.
> 
> That said this formulation (not your I know) is confusing. What does 
> bytesPerWord have to do with the amount of stack needed? Is this just 
> some weird way of getting twice the amount of stack on 64-bit as 32-bit? 
> Are the pages sizes even the same in that case?
> 
> Also in os_solaris.cpp isn't this guarantee always false:
> 
> !   guarantee(os::Solaris::min_stack_allowed >= thr_min_stack(),
> !             "need to increase min_stack_allowed");
> 
> AFAICS min_stack_allowed is set to one of these values:
> 
> ./os_cpu/solaris_sparc/vm/os_solaris_sparc.cpp:size_t 
> os::Solaris::min_stack_allowed = 128*K;
> ./os_cpu/solaris_sparc/vm/os_solaris_sparc.cpp:size_t 
> os::Solaris::min_stack_allowed = 96*K;
> ./os_cpu/solaris_x86/vm/os_solaris_x86.cpp:size_t 
> os::Solaris::min_stack_allowed = 224*K;
> ./os_cpu/solaris_x86/vm/os_solaris_x86.cpp:size_t 
> os::Solaris::min_stack_allowed = 64*K;
> 
> but the manpage for thr_min_stack states:
> 
>     thr_min_stack() will return the unsigned int  THR_MIN_STACK,
>     which is the minimum-allowable size for a thread's stack.
> 
>     In this implementation the default size for a  user-thread's
>     stack   is   one   mega-byte.
> 
> 1MB > all the above. ???
> 
> Cheers,
> David
> 
> Coleen Phillimore said the following on 10/05/10 08:45:
>> Summary: min_stack_allowed is a compile time constant and Stack*Pages 
>> are settable
>>
>> Also stress tested various combinations of -Xss and 
>> -XX:StackShadowPages=n.  This also fixes a bug
>> 6346701: stack overflow in native method results in segfault, not a 
>> StackOverflowError
>> or rather it fixes the observed SEGVs with different settings of -Xss 
>> and -XX:StackShadowPages in the evaluation.  We were getting stack 
>> overflow before the stack overflow exception was initialized, causing 
>> infinite recusion trying to initialize it.
>>
>> Also fixed a random g++ compilation error.
>>
>> open webrev at http://cr.openjdk.java.net/~coleenp/6983240/
>> bug link at http://bugs.sun.com/view_bug.do?bug_id=6983240
>>
>> Thanks,
>> Coleen


More information about the hotspot-runtime-dev mailing list