RFR: Add a limition to allocate object heap in aarch64 with tsan enabled.

Jie He github.com+10233373+jhe33 at openjdk.java.net
Tue Apr 21 05:50:34 UTC 2020


On Mon, 20 Apr 2020 23:41:36 GMT, Man Cao <manc 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.
>
> src/hotspot/share/runtime/arguments.cpp line 1859:
> 
>> 1858:
>> 1859:     // With current TSan memory mapping of 48bit aarch64, it's very hard to allocate large continuous space.
>> 1860:     // Add a limitation to avoid the allocation failure in machine with huge physical RAM.
> 
> I'm not familiar with this. Is the 48bit aarch64 issue due to implementation detail of LLVM TSAN runtime? Could you add
> a link to either documentation or source code for this issue?

struct Mapping48 {
  static const uptr kLoAppMemBeg   = 0x0000000001000ull;
  static const uptr kLoAppMemEnd   = 0x0000200000000ull;
  static const uptr kShadowBeg     = 0x0002000000000ull;
  static const uptr kShadowEnd     = 0x0004000000000ull;
  static const uptr kMetaShadowBeg = 0x0005000000000ull;
  static const uptr kMetaShadowEnd = 0x0006000000000ull;
  static const uptr kMidAppMemBeg  = 0x0aaaa00000000ull;
  static const uptr kMidAppMemEnd  = 0x0aaaf00000000ull;
  static const uptr kTraceMemBeg   = 0x0f06000000000ull;
  static const uptr kTraceMemEnd   = 0x0f06200000000ull;
  static const uptr kHeapMemBeg    = 0x0ffff00000000ull;
  static const uptr kHeapMemEnd    = 0x0ffff00000000ull;
  static const uptr kHiAppMemBeg   = 0x0ffff00000000ull;
  static const uptr kHiAppMemEnd   = 0x1000000000000ull;
  static const uptr kAppMemMsk     = 0x0fff800000000ull;
  static const uptr kAppMemXor     = 0x0000800000000ull;
  static const uptr kVdsoBeg       = 0xffff000000000ull;
};

yes, LLVM tsan defines 48bit aarch64 memory mapping as above. under this setting, openjdk is very hard to get a large
continuous vm space (roughly <20G), object heap allocation often fail in a machine which has huge physical RAM.

big object heap will be allocated in this range:
 static const uptr kMidAppMemBeg  = 0x0aaaa00000000ull;
  static const uptr kMidAppMemEnd  = 0x0aaaf00000000ull;

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

PR: https://git.openjdk.java.net/tsan/pull/6


More information about the tsan-dev mailing list