RFR: 8049536: os::commit_memory on Solaris uses aligment_hint as page size

Erik Helin erik.helin at oracle.com
Thu Sep 11 14:15:25 UTC 2014


Hi all,

this small patch fixes a problem with the arguments to the syscall 
memcntl on Solaris.

When memcntl is used with MHA_MAPSIZE_VA to tell the system the 
preferred page size for a memory area, the mha_pagesize member of the 
struct memcntl_mha argument must be a valid page size (a valid page size 
if one of the sizes returned by the syscall getpagesizes).

One variant of the function os::commit_memory has an alignment_hint 
parameter and the code in os::Solaris::commit_memory_impl sometimes 
passes this alignment_hint as the mha_pagesize to memcntl. The issue is 
that there is no check that this alignment_hint actually is a valid page 
size.

This patch selects the largest page size that divides the alignment_hint 
(the _page_sizes array is sorted in descending order). I also added a 
bunch of asserts to check preconditions.

Bug: https://bugs.openjdk.java.net/browse/JDK-8049536

Webrev: http://cr.openjdk.java.net/~ehelin/8049536/webrev.00/

Testing:
- JPRT
- Tested with the patch for
   https://bugs.openjdk.java.net/browse/JDK-8027915
   which immediately provokes the bug on Solaris SPARC when just running
   java -version. Now it works fine.

Thanks,
Erik



More information about the hotspot-gc-dev mailing list