RFR: 8324781: runtime/Thread/TestAlwaysPreTouchStacks.java failed with Expected a higher ratio between stack committed and reserved [v6]
Liming Liu
duke at openjdk.org
Wed Apr 17 03:18:48 UTC 2024
On Tue, 16 Apr 2024 09:47:53 GMT, Liming Liu <duke at openjdk.org> wrote:
>> src/hotspot/os/linux/os_linux.cpp line 4836:
>>
>>> 4834: bool supportMadvPopulateWrite =
>>> 4835: ((major > 5 || (major == 5 && minor >= 14)) &&
>>> 4836: (::madvise(0, 0, MADV_POPULATE_WRITE) == 0));
>>
>> Shouldn't this be checking ` MADV_POPULATE_WRITE_value `?
>>
>> I still can't get my head around the possible compile time values versus the potential runtime interpretation of the ` MADV_POPULATE_WRITE` value.
>
> For example, Linux 5.4-UEK does not support populating pages, and `MADV_POPULATE_WRITE` is not defined there. However, the kernel internally interprets 23 as `MADV_DONEXEC`, while 23 is a value used by upstream kernels as `MADV_POPULATE_WRITE`. `MADV_POPULATE_WRITE_value` is used by hotspot internally, and used for compiling JDK properly when `MADV_POPULATE_WRITE` is not defined. `MADV_POPULATE_WRITE_value` was suggested there: https://github.com/openjdk/jdk/pull/15781#discussion_r1345784162
Additionally, If `MADV_POPULATE_WRITE` is defined but not the same as `MADV_POPULATE_WRITE_value`, there will be a build failure, so hotspot is guaranteed to use 23 here regardless of compile time or runtime. 23 may not be interpreted as `MADV_POPULATE_WRITE` by a downstream kernel. A known case is a downstream of pre-5.14 kernel, so the version of kernel is checked here. This patch does not have tricks on advice numbers.
-------------
PR Review Comment: https://git.openjdk.org/jdk/pull/18592#discussion_r1568162283
More information about the hotspot-runtime-dev
mailing list