RFR: 8280056: gtest/LargePageGtests.java#use-large-pages failed "os.release_one_mapping_multi_commits_vm" [v2]

Afshin Zafari azafari at openjdk.org
Fri Oct 20 12:20:36 UTC 2023


On Wed, 18 Oct 2023 14:58:15 GMT, Afshin Zafari <azafari at openjdk.org> wrote:

>> The `attempt_allocate_memory_at(addr, size)` may fail for some reasons that `::mmap`  will report. To find out why an attempt failed, an `int *` is passed down deep to the `::mmap` to return the `ERRNO` back to the callers.
>> This error code is used in gTest test case to show a proper message.
>> 
>> The changed test case never failed after 10K+ repetitions, but in case it happens in future the reason is also printed out.
>
> Afshin Zafari has updated the pull request incrementally with one additional commit since the last revision:
> 
>   some pd_xxx calls were missed.

Using `MAP_FIXED_NOREPLACE` in `::mmap` makes it thread-safe (only one thread will succeed). [mmap man page](https://man7.org/linux/man-pages/man2/mmap.2.html#:~:text=flag%20in%20NOTES!-,MAP_FIXED_NOREPLACE)
In `hotspot/os/linux/os_linux.cpp:3506` ([here](https://github.com/openjdk/jdk/blob/40106422bd2ae3da98d028bdbab2c240a71081e3/src/hotspot/os/linux/os_linux.cpp#L3506)) that flag is used if the requested address is not null.

Are we still suspicious about multi-thread reasons?

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

PR Comment: https://git.openjdk.org/jdk/pull/16240#issuecomment-1772635097


More information about the hotspot-runtime-dev mailing list