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

Florian Weimer fweimer at redhat.com
Wed Jun 26 14:47:35 UTC 2019


* Thomas Stüfe:

> About the attr pointer to pthread_get_minstack(): Since this function
> is undocumented, we have no idea what it does to attr. We know that
> the implementation Florian posted seems not to do anything with it,
> but is that true for all glibc implementations, over all past versions
> we want to function on, and on all platforms?

Ahh, sorry, you are right.  The historic implementation looks like this:

size_t
__pthread_get_minstack (const pthread_attr_t *attr)
{
  struct pthread_attr *iattr = (struct pthread_attr *) attr;

  return (GLRO(dl_pagesize) + __static_tls_size + PTHREAD_STACK_MIN
         + iattr->guardsize);
}

So you need to pass the attribute you use during thread creation.
__pthread_get_minstack was changed when once the guardsize was no longer
subtracted from the available stack size, so you should not subtract the
guard size in OpenJDK, only sysconf (_SC_PAGESIZE) and
PTHREAD_STACK_MIN.

Thanks,
Florian


More information about the hotspot-runtime-dev mailing list