RFR: 8262291: Refactor reserve_memory_special_huge_tlbfs
Ivan Walulya
iwalulya at openjdk.java.net
Tue Mar 23 23:12:39 UTC 2021
On Tue, 23 Mar 2021 20:20:15 GMT, Stefan Johansson <sjohanss at openjdk.org> wrote:
>> src/hotspot/os/linux/os_linux.cpp line 3929:
>>
>>> 3927: }
>>> 3928:
>>> 3929: char* os::Linux::reserve_and_commit_special(size_t bytes,
>>
>> method name `reserve_and_commit_` implicitly suggests that other methods with just `reserve_memory_` do not commit (to me).
>
> That is a good point, I've struggled a bit with this function name. Since we actually do the reservation using the call to `anon_mmap_aligned()` maybe this one should just be called: `commit_memory_special()`
yes, seems better to me
>> 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`.
ok, now I get it. I had missed that when mmap fails, the original reservation is unmapped for this range so no need to do any additional clean up.
-------------
PR: https://git.openjdk.java.net/jdk/pull/3073
More information about the hotspot-dev
mailing list