RFR: 8229147: Linux os::create_thread() overcounts guardpage size with newer glibc (>=2.27)
David Holmes
dholmes at openjdk.org
Sun Apr 23 01:49:54 UTC 2023
On Sat, 22 Apr 2023 13:31:41 GMT, Thomas Stuefe <stuefe at openjdk.org> wrote:
>> 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.
@tstuefe that is all true and correct, but what we don't know (without looking at the implementation) is what `__get_minstack` will do with the value in the attribute. I guess I need to find the old version of the code and see whether it does a raw read or adjusts it somehow based on pagesize.
-------------
PR Review Comment: https://git.openjdk.org/jdk/pull/13571#discussion_r1174490974
More information about the hotspot-runtime-dev
mailing list