RFR: 8229147: Linux os::create_thread() overcounts guardpage size with newer glibc (>=2.27)
Thomas Stuefe
stuefe at openjdk.org
Sat Apr 22 14:15:50 UTC 2023
On Sat, 22 Apr 2023 00:51:22 GMT, David Holmes <dholmes at openjdk.org> wrote:
>> Does this work on arches with 64K pages? Perhaps we need to check the return value of this call to make sure we were successful in setting the guard size to begin with. Otherwise we can "accidentally" discover the min_stack is not changing?
>
> Good point. Should I use `os::vm_page_size()`?
>
> The call cannot actually fail on Linux (none of these call can, hence no return code checking).
pthread_attr_setguardsize takes the value and stores it in the attribute as-is, since [POSIX](https://pubs.opengroup.org/onlinepubs/009604599/functions/pthread_attr_getguardsize.html) requires:
"If an implementation rounds up the value of guardsize to a multiple of {PAGESIZE}, a call to pthread_attr_getguardsize() specifying attr shall store in the guardsize parameter the guard size specified by the previous pthread_attr_setguardsize() function call."
pthread_create, when creating the thread, will round up the size to the nearest page size.
-------------
PR Review Comment: https://git.openjdk.org/jdk/pull/13571#discussion_r1174416774
More information about the hotspot-runtime-dev
mailing list