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

Erik Helin erik.helin at oracle.com
Thu Sep 11 16:55:11 UTC 2014


All,

based on feedback offline from Stefan Karlsson I've updated the patch:
- The third assert in setup_large_pages can be:
     is_size_aligned(bytes, align)
   since if `start` is aligned to `align` and `bytes` is aligned to
   `align`, then `start` + `bytes` is also aligned to `align`. This also
   means the debug_only statement could be removed.
- Since caddr_t is a pointer type (char* on Solaris) it can be
   casted to void* and then the second assert in setup_large_pages can
   use is_ptr_aligned.
- The if statement in os::Solaris::commit_memory_impl should also guard
   against alignment_hint being zero, since the existing check assures
   this.

Please see new webrevs:
- full: http://cr.openjdk.java.net/~ehelin/8049536/webrev.01/
- incremental: http://cr.openjdk.java.net/~ehelin/8049536/webrev.00-01/

Thank you StefanK for the feedback!

Erik

On 2014-09-11 16:15, 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.
>
> 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