RFR: 8225035: Thread stack size issue caused by large TLS size
Thomas Stüfe
thomas.stuefe at gmail.com
Wed Jun 26 14:59:22 UTC 2019
Hi Florian,
On Wed, Jun 26, 2019 at 4:47 PM Florian Weimer <fweimer at redhat.com> wrote:
> * 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.
>
But we have not yet called pthread_attr_setguardsize() by the time we call
__pthread_get_minstack. So attr contains whatever is the default set
by pthread_attr_init(). Also, some lines below we add the guard size
manually to the stack size, for similar reasons we now want to add the TLS
size...
All this outguessing the glibc makes my head hurt :)
> __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.
>
>
Which versions of glibc have this historic implementation? Do we need to
care?
..Thomas
> Thanks,
> Florian
>
More information about the hotspot-runtime-dev
mailing list