RFR: 8229147: Linux os::create_thread() overcounts guardpage size with newer glibc (>=2.27)

David Holmes dholmes at openjdk.org
Sun Apr 23 01:57:51 UTC 2023


On Sat, 22 Apr 2023 13:54:09 GMT, Thomas Stuefe <stuefe at openjdk.org> wrote:

>> We can now detect whether glibc includes the guard pages as part of the requested stack size or not, and so only need to make adjustments when glibc requires it.
>> 
>> The intent was to use a local variable as the "flag" but unfortunately it is also needed in os_posix.cpp so I had to make it part of the os::Linux API.
>> 
>> See bug report (and related) for details.
>> 
>> Testing:
>>   - Manually checked log output for stack sizes and boundaries on systems with and without the glibc fix. (Again see JBS issue)
>>   -  Tiers 1-3 sanity
>> Thanks
>
> src/hotspot/os/linux/os_linux.cpp line 4549:
> 
>> 4547: 
>> 4548:   // Check if we need to adjust the stack size for glibc guard pages.
>> 4549:   init_adjust_stack_for_guard_pages();
> 
> Please make this glibc only. I agree with @TheRealMDoerr, muslc does not have `__pthread_get_minstack`, no need to pay for a dynamic lookup that will always fail.

To a degree this is pre-existing behaviour - nothing to do with `AdjustStackSizeForTLS` is glibc-only even though it is. So I would have to change that as well, which broadens the scope and is not something I can, or want to, test!

-------------

PR Review Comment: https://git.openjdk.org/jdk/pull/13571#discussion_r1174491973


More information about the hotspot-runtime-dev mailing list