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

Thomas Schatzl thomas.schatzl at oracle.com
Thu Sep 11 15:23:41 UTC 2014


Hi,

On Thu, 2014-09-11 at 16:15 +0200, Erik Helin wrote:
> 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.
> 

Where does this wrong alignment come from? Only from the user via
-XX:LargePageAlignmentInBytes? 

If so, wouldn't it be better to make this adjustment during argument
processing? Then the VM could inform the user about the change to some
degree, either per message, or by overriding the given value
(using FLAG_SET_xxx).

The alignment_hint should still be checked for validity when it is
used, but I think if the method gets a wrong value for the hint from
anywhere other than the user, it imo should be an error. Not silently
adjusted which potentially leads to hard to find performance problems.

> 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.

Can you add a test case that checks there is no "MPSS failed" message with
various LargePageAlignmentInBytes values?

Thanks,
  Thomas





More information about the hotspot-gc-dev mailing list