RFR: 8253332: ZGC: Make heap views reservation platform independent
Stefan Karlsson
stefank at openjdk.java.net
Fri Sep 18 08:30:10 UTC 2020
On Fri, 18 Sep 2020 08:17:57 GMT, Aleksey Shipilev <shade at openjdk.org> wrote:
>> ZVirtualMemoryManager::reserve_contiguous_platform tries to reserve three views of a given address range. The posix and
>> windows versions are more or less duplicates, with calls to platform dependent versions of reserve/unreserve functions.
>> I'd like to clean this up in preparation of an alternative implementation for heap memory allocation on Windows.
>>
>> I choose to prefix the OS dependent functions with os_. For consistency, initialize_os should have been renamed as
>> well, but the plan is to change that in a separate patch that splits that function into two, so I skipped it for now.
>
> src/hotspot/os/posix/gc/z/zVirtualMemory_posix.cpp line 45:
>
>> 43: if (res != addr) {
>> 44: // Failed to reserve memory at the requested address
>> 45: os_unreserve(res, size);
>
> A bit odd to see the assymetry here: `mmap` is used above, so `munmap` would be expected here? I see `os_unreserve`
> does the same thing, but does it guaranteed to do so?
Yes. I agree. Will fix.
> src/hotspot/share/gc/z/zVirtualMemory.cpp line 126:
>
>> 124:
>> 125: // Register address views with native memory tracker
>> 126: nmt_reserve(ZAddress::marked0(start), size);
>
> The first arguments are the same as locals `marked0`, `marked1`, `remapped` above, right? Can be reused then?
Yes. At one point I had this part extracted into a separate function and had to re-resolve those values.
-------------
PR: https://git.openjdk.java.net/jdk/pull/236
More information about the hotspot-gc-dev
mailing list