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

David Holmes dholmes at openjdk.org
Sun Apr 23 02:03:56 UTC 2023


On Sat, 22 Apr 2023 14:10:54 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 843:
> 
>> 841:     // then we need to perform the adjustment.
>> 842:     os::Linux::AdjustStackSizeForGuardPages = (min_stack2 - min_stack > 0);
>> 843:     log_info(os)("- glibc stack size guard page adjustment is %sneeded",
> 
> Why the leading dash?

It was to make it look like part of the version check:

[0.003s][info ][os] HotSpot is running with glibc 2.17, NPTL 2.17
[0.003s][info ][os] - glibc stack size guard page adjustment is not needed

but I realize now that can be messed up by other logging:

[0.003s][info ][os] HotSpot is running with glibc 2.17, NPTL 2.17
[0.003s][info ][os,thread] Lookup of __pthread_get_minstack succeeded
[0.003s][info ][os       ] - glibc stack size guard page adjustment is not needed

so I will change it.

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

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


More information about the hotspot-runtime-dev mailing list