RFR: 8225035: Thread stack size issue caused by large TLS size
David Holmes
david.holmes at oracle.com
Tue Jun 11 07:56:03 UTC 2019
Hi Jiangli,
Some initial feedback ...
On 11/06/2019 8:29 am, Jiangli Zhou wrote:
> Hi David and Florian,
>
> This the a follow up of the discussion regarding the TLS (Thread Local
> Storage) issue:
> http://mail.openjdk.java.net/pipermail/hotspot-runtime-dev/2019-May/034459.html.
> The following is an updated patch with your suggestions incorporated:
>
> 1) Use __pthread_get_minstack
> 2) By default only adjust the thread stack size if the
> minstack-to-stacksize ratio is >= 10%
> 3) Introduce a new command-line option (Linux only),
> AdjustWithMinStackAt, which can be used to change the default 10%
> ratio for triggering stack size adjustment
I don't understand why the flag range is 0.0 to 50.0. If 0.1 = 10% then
50 = 500%, which means the minstack is 5x greater than the actual
requested stack! The flag has to be limited between 0 and 100% AFAICS
else the requested stack size is too small to accommodate the "min
stack" and the attempt to create the thread will presumably fail. ??
827 static void pthread_get_minstack_init() {
828 // The code below uses the static symbol if available.
829 // If not, it will use dlsym to search for the symbol at runtime.
830 p_pthread_get_minstack = &__pthread_get_minstack;
I don't understand this part. If at runtime the "static" symbol doesn't
exist, won't this generate an error from the loader and prevent the VM
from starting?
Style nit: p_pthread_get_minstack
Can you drop the "p" prefix and just use _pthread_get_minstack similar
to other dynamically determined functions please.
+ min_stack_size = (*p_pthread_get_minstack)(attr);
When you have a function pointer you don't need to dereference it to
invoke it, you can just do:
min_stack_size = p_pthread_get_minstack(attr);
+ if (p_pthread_get_minstack) {
Style nit: Please avoid implicit booleans and check != NULL.
I don't quite see what the test is doing - why does the Java code run
"echo" ?? I expected to see different values of AdjustWithMinStackAt
being used and threads then checking whether their stacks have been
adjusted or not; and in some cases to get errors. ??
> CSR: https://bugs.openjdk.java.net/browse/JDK-8225498
I'm still thinking about the right name, type and range for the flag,
which will impact the CSR.
Thanks,
David
-----
> webrev: http://cr.openjdk.java.net/~jiangli/8225035/webrev.00/
> bug: https://bugs.openjdk.java.net/browse/JDK-8225035
>
> Best regards,
>
> Jiangli
>
More information about the hotspot-runtime-dev
mailing list