RFR(S) JDK-8025526: VirtualSpace should support per-instance disabling of large pages

Erik Helin erik.helin at oracle.com
Fri Sep 27 15:10:02 UTC 2013

Hi Mikael,

what do you think about splitting the VirtualSpace::initialize method
into two methods:
- VirtualSpace::initialize
- VirtualSpace::initialize_with_granularity

Then initialize would just call initialize_with_granularity like the

  bool VirtualSpace::initialize(ReservedSpace rs, size_t committed_size) {
    size_t granularity = os::page_size_for_regions(rs.size(), rs.size(), 1);
    return initialize_with_granularity(rs, committed_size, granularity);

  bool VirtualSpace::initialize_with_granularity(ReservedSpace rs,
    size_t committed_size, size_t granularity) {
    assert(granularity > 0, "Can't have 0 as granularity");
    // old initialize code
    _middle_alignment = granularity;
    // rest of old initialized code

This way, we get rid of the default argument and don't have to check if
max_commit_granularity == 0.


On 2013-09-27, Mikael Gerdin wrote:
> Hi,
> As part of ongoing work in getting Metaspace to properly enforce the
> MaxMetaspaceSize limit [JDK-8024547] we need to extend the
> VirtualSpace class to allow us to set the granularity at which
> VirtualSpace commits pages from the OS.
> Summary of changes:
> Extend VirtualSpace::initialize to take a parameter for setting the
> maximum commit granularity. The default value 0 keeps the previous
> behavior of using os::page_size_for_region to determine the
> granularity.
> Add unit tests for disabling and enabling large pages both at the
> ReservedSpace and the VirtualSpace level.
> Testing:
> JPRT run (includes running the new tests)
> Webrev: http://cr.openjdk.java.net/~mgerdin/8025526/webrev.0
> Bug link: https://bugs.openjdk.java.net/browse/JDK-8025526
> /Mikael

More information about the hotspot-gc-dev mailing list