RFR: 8225035: Thread stack size issue caused by large TLS size

Jiangli Zhou jianglizhou at google.com
Tue Jul 2 15:08:24 UTC 2019


Hi Florian,

On Tue, Jul 2, 2019 at 4:20 AM Florian Weimer <fweimer at redhat.com> wrote:
>
> * Jiangli Zhou:
>
> > No problem at all! I actually thought in the same direction as well
> > when making the change initially but didn't go with it as I had some
> > concerns. Florian's latest reply is reassuring (thanks again!). So
> > here is the update:
> > http://cr.openjdk.java.net/~jiangli/8225035/webrev_inc.05/.
>
> I'm sorry, but I'm not familiar with Hotspot.  Is there external
> locking?  Otherwise this code is not thread-safe.

The first time when get_static_tls_area_size is called, it happens
during early JVM initialization when the main thread is trying to
spawn a GC thread (it is the first thread being created by the main
thread). The 'tls_size' is fully initialized before the creation of
the new thread. I think it's safe without an extra lock protection
since there's no race here.

If we want to be extra cautious, we could initialize 'tls_size' as
part of get_minstack_init during os::init_2. I'm not sure if there are
cases where __pthread_get_minstack() is called too 'early' during an
execution and not be able to get the proper result? I feel safer with
the current change.

Best regards,
Jiangli

>
> Thanks,
> Florian


More information about the hotspot-runtime-dev mailing list