RFR: 8265268: Unify ReservedSpace reservation code in initialize and try_reserve_heap [v2]
Ivan Walulya
iwalulya at openjdk.java.net
Thu Apr 22 16:03:22 UTC 2021
On Thu, 22 Apr 2021 14:01:48 GMT, Stefan Johansson <sjohanss at openjdk.org> wrote:
>> Please review this change to unify the reservation code in ReservedSpace.
>>
>> **Summary**
>> The code in `ReservedSpace::initialize(...)` and `ReservedHeapSpace::try_reserve_heap(...)` is very similar and more or less does the same things. The difference between them is logging, what is considered a failure and how that is handled.
>>
>> This change introduces a new function `ReservedSpace::reserve(...)` that is used by both `initialize(...)` and `try_reserve_heap(...)`. The biggest reason for only having one function handling the reservations is to avoid code duplication and having to change two places when something needs to be updated.
>>
>> There will be some small changes in what is getting logged in some cases, but the goal is to avoid changing behavior as much as possible.
>>
>> Some additional notes to help reviewing:
>> * There are two reservation helpers:
>> `reserve_memory()` for regular pages and file backed mappings.
>> `reserve_memory_special()` for explicit large pages.
>> * In `reserve_memory()` the `is_align()`-check at the end was previously done at the end of `initialize()`. It was moved here because this is the only case where an unaligned address can be returned. For large pages as well as when a requested address is provided, the returned address will be aligned.
>> * The support to have a backing file is only used by the heap when `AllocateHeapAt` is set. If this option is used together with `UseLargePages` a debug message is printed since it is up to the backing file system if large pages are used or not. This output has been unified and is now printed when the file is created rather then deep in the reservation code. Previously this message differed depending on if `UseCompressedOops` was enabled or not. Now the same message is printed for both cases.
>>
>> * The failure checking function `failed_to_reserve_as_requested(...)` now only checks if the memory was allocated at the expected address. Releasing the memory is done by the caller.
>>
>> * The size passed into `map_or_reserve_memory_aligned` was previously aligned up using the alignment, but the size should always be aligned already. An assert has been added to the start of the `reserve` function and the `align_up` has been removed.
>>
>> **Testing**
>> A lot of local testing as well as tier1-tier5 in Mach5.
>
> Stefan Johansson has updated the pull request incrementally with one additional commit since the last revision:
>
> Thomas and Ivan review
Marked as reviewed by iwalulya (Committer).
-------------
PR: https://git.openjdk.java.net/jdk/pull/3570
More information about the hotspot-dev
mailing list