RFR: 8252500: ZGC on aarch64: Unable to allocate heap for certain Linux kernel configurations [v2]

Stefan Karlsson stefank at openjdk.java.net
Mon Sep 7 10:26:32 UTC 2020


On Mon, 7 Sep 2020 09:51:21 GMT, Christoph Göttschkes <cgo at openjdk.org> wrote:

>> src/hotspot/cpu/aarch64/gc/z/zGlobals_aarch64.cpp line 183:
>> 
>>> 181:     void* result_addr = mmap((void*) high_addr, page_size, PROT_NONE, MAP_PRIVATE|MAP_ANONYMOUS|MAP_NORESERVE, -1,
>>> 0); 182:     if (result_addr != MAP_FAILED) {
>>> 183:       max_address_bit = BitsPerSize_t - count_leading_zeros((size_t) result_addr) - 1;
>> 
>> It's not obvious to me that the '- 1' is correct here.
>
> Let's assume the probing failed (for whatever reason) and we are actually able to allocate DEFAULT_MAX_ADDRESS_BIT:
> 00000000_00000000_10000000_00000000_00000000_00000000_00000000_00000000 = 1U << DEFAULT_MAX_ADDRESS_BIT
> Mmap succeeds and returns exactly that address. Now the line would evaluate to the following:
> 64 - 16 - 1 = 47 <=> DEFAULT_MAX_ADDRESS_BIT

I think this looks OK now that you moved the +1 to ZPlatformAddressOffsetBits().

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

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



More information about the hotspot-gc-dev mailing list