JDK-8049536 : os::commit_memory on Solaris uses aligment_hint as page size
  • Type: Bug
  • Component: hotspot
  • Sub-Component: gc
  • Affected Version: 9
  • Priority: P4
  • Status: Resolved
  • Resolution: Fixed
  • OS: solaris
  • CPU: sparc
  • Submitted: 2014-07-08
  • Updated: 2024-01-25
  • Resolved: 2014-09-15
The Version table provides details related to the release that this issue/RFE will be addressed.

Unresolved : Release in which this issue/RFE will be addressed.
Resolved: Release in which this issue/RFE has been resolved.
Fixed : Release in which this issue/RFE has been fixed. The release containing this fix may be available for download as an Early Access Release or a General Availability Release.

To download the current JDK release, click here.
JDK 8 JDK 9
8u60Fixed 9 b33Fixed
Related Reports
Blocks :  
Duplicate :  
Description
os::commit_memory takes a size_t `alignment_hint` as parameter. This parameter is used differently on different operating systems: it is ignored on all operating system except for Solaris. For Solaris, the hint is used for selecting the large page size. In a special case, the hint is interpreted as the *exact* page size.

This problem had previously been hidden because due to various alignments of heap sizes and generation sizes always made sure that we ended up with a alignment_hint of 4 MB by default, which also happens to be a valid page size.

The bug can be triggered by running:
java -Xms32m -Xmx128m -XX:LargePageSizeInBytes=256m -version
Comments
URL: http://hg.openjdk.java.net/jdk9/jdk9/hotspot/rev/cde40424bcd4 User: lana Date: 2014-10-02 03:09:11 +0000
02-10-2014

URL: http://hg.openjdk.java.net/jdk9/hs-gc/hotspot/rev/cde40424bcd4 User: ehelin Date: 2014-09-15 13:26:47 +0000
15-09-2014

After some more work on this, I have some more information. Below is the output from an instrumented VM: Supported page sizes: 4194304 8192 Arguments: start: 0x0000000780000000 bytes: 67108864 align: 524288 perror("memcntl"): memcntl: Invalid argument (EINVAL) Java HotSpot(TM) 64-Bit Server VM warning: Attempt to use MPSS failed. The man page for memcntl states: ERRORS The memcntl() function will fail if: EINVAL ... The mha_pagesize or mha_cmd member is invalid. ... regarding the use of MC_HAT_ADVISE, the man page states: MC_HAT_ADVISE Advise system how a region of user-mapped memory will be accessed. The arg argument is interpreted as a "struct memcntl_mha *". The following members are defined in a struct memcntl_mha: uint_t mha_cmd; uint_t mha_flags; size_t mha_pagesize; The accepted values for mha_cmd are: MHA_MAPSIZE_VA MHA_MAPSIZE_STACK MHA_MAPSIZE_BSSBRK The mha_flags member is reserved for future use and must always be set to 0. The mha_pagesize member must be a valid size as obtained from getpagesizes(3C) or the con- stant value 0 to allow the system to choose an appropri- ate hardware address translation mapping size. MHA_MAPSIZE_VA sets the preferred hardware address translation mapping size of the region of memory from addr to addr + len. Both addr and len must be aligned to an mha_pagesize boundary. The entire virtual address region from addr to addr + len must not have any holes. Permissions within each mha_pagesize-aligned portion of the region must be consistent. When a size of 0 is specified, the system selects an appropriate size based on the size and alignment of the memory region, type of processor, and other considerations. MHA_MAPSIZE_STACK sets the preferred hardware address translation mapping size of the process main thread stack segment. The addr and len arguments must be NULL and 0, respectively. MHA_MAPSIZE_BSSBRK sets the preferred hardware address translation mapping size of the process heap. The addr and len arguments must be NULL and 0, respectively. See the NOTES section of the ppgsz(1) manual page for addi- tional information on process heap alignment. Note the part: The mha_pagesize member must be a valid size as obtained from getpagesizes(3C) or the con- stant value 0 to allow the system to choose an appropri- ate hardware address translation mapping size. The output from the VM shows that we are passing 524288 and the only supported pages sizes are 8192, 4194304 (some larger page sizes might be supported but deemed unusable by the JVM). An assert should at least be added to os::Solaris::setup_large_pages to check that the alignment hint always is a valid page size. Now, the question remains why some code is passing 524288 to os::Solaris::setup_large_pages....
04-09-2014

The fix for JDK-8027915 triggers this bug when just running "java -version" on Solaris.
08-07-2014