[Rev 01] RFR: Add a limition to allocate object heap in aarch64 with tsan enabled.
Man Cao
manc at openjdk.java.net
Fri Apr 24 04:49:10 UTC 2020
On Thu, 23 Apr 2020 11:27:42 GMT, Jie He <github.com+10233373+jhe33 at openjdk.org> wrote:
>> Vm will calculate max heap size according to the physical ram if user
>> doesn't specify the size(-Xmx). However, with tsan 48-bits memory
>> mapping of aarch64, it's hard to allocate the large continuous vm
>> space. Heap allocation often fail in this case, thus, add a limitation
>> at the end of the heap size calculation to prevent to exceed the
>> avaiable size. Currently, only support 48-bits address space.
>>
>> Can reproduce the behavior by launching "java --version" in a machine
>> with huge physical memory.
>
> Jie He has refreshed the contents of this pull request, and previous commits have been removed. The incremental views
> will show differences compared to the previous content of the PR. The pull request contains one new commit since the
> last revision:
> Add a limit to allocate object heap in aarch64 with tsan enabled.
>
> Vm will calculate max heap size according to the physical ram if user
> doesn't specify the size(-Xmx). However, with tsan 48-bits memory
> mapping of aarch64, it's hard to allocate the large continuous vm
> space. Heap allocation often fail in this case, thus, add a limit
> at os::has_allocatable_memory_limit to prevent to exceed the
> avaiable size. Currently, only support 48-bits address space.
>
> Can reproduce the behavior by launching "java --version" in a machine
> with huge physical memory.
>
> Change-Id: Iabff934444091436bc657978e2e947c270398f29
Changes requested by manc (Reviewer).
src/hotspot/os/posix/os_posix.cpp line 541:
> 540:
> 541: #if defined(INCLUDE_TSAN) && defined(AARCH64)
> 542: // Current TSAN memory mapping for 48bits aarch64, a large continous space could be allocated between
INCLUDE_TSAN is always defined, it has a value of 0 or 1 (see make/hotspot/lib/JvmFeatures.gmk).
Probably "#if INCLUDE_TSAN && defined(AARCH64)".
src/hotspot/os/posix/os_posix.cpp line 550:
> 549: u8 vm_addr_u8 = reinterpret_cast<u8>(&__FUNCTION__);
> 550: // High address in 48bits user space is like 0x0000ffffxxxxxxxx.
> 551: assert((vm_addr_u8 >> msb_in_aarch64) == 0x1, "warning: allocation could fail in non 48-bit address space.");
Is this based on kHiAppMemBeg = 0x0ffff00000000ull and kHiAppMemEnd = 0x1000000000000ull?
Mentioning these two constants like kMidAppMemBeg and kMidAppMemEnd above would be a more helpful comment.
src/hotspot/os/posix/os_posix.cpp line 545:
> 544: // Take 16GB here for safer allocation.
> 545: const julong max_avail_vmspace = 1024ULL * 1024ULL * 1024ULL * 16ULL; // 16GB
> 546: const u8 msb_in_aarch64 = 47; //Only support 48-bits space now.
"16ULL * G" is simpler.
src/hotspot/os/posix/os_posix.cpp line 546:
> 545: const julong max_avail_vmspace = 1024ULL * 1024ULL * 1024ULL * 16ULL; // 16GB
> 546: const u8 msb_in_aarch64 = 47; //Only support 48-bits space now.
> 547:
Nit: need one space after //.
-------------
PR: https://git.openjdk.java.net/tsan/pull/6
More information about the tsan-dev
mailing list