RFR: 8262291: Refactor reserve_memory_special_huge_tlbfs

Ivan Walulya iwalulya at openjdk.java.net
Tue Mar 23 23:04:42 UTC 2021


On Tue, 23 Mar 2021 20:23:23 GMT, Stefan Johansson <sjohanss at openjdk.org> wrote:

>> src/hotspot/os/linux/os_linux.cpp line 3990:
>> 
>>> 3988:   char* large_mapping = reserve_and_commit_special(large_bytes, os::large_page_size(), aligned_start, exec);
>>> 3989: 
>>> 3990:   if (bytes == large_bytes) {
>> 
>> Shouldn't we do the check `if (large_mapping == NULL) {` before this?
>
> We could, and I thought about adding a comment here. I probably should have. The reason we don't do the explicit check it is that if `large_mapping == NULL` then NULL will be returned as expected and there is no additional work to be done if `bytes == large_bytes`.

When `bytes == large_bytes` don't we need to `unmap` the original reservation in case `reserve_and_commit_special`  fails i.e `large_mapping == NULL`? 

Below we have the comment 
// Large mapping failed, so we need to unmap the reminder
// of the orinal reservation.

Maybe I am missing something.

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

PR: https://git.openjdk.java.net/jdk/pull/3073


More information about the hotspot-dev mailing list