RFR: 8236847: CDS archive with 4K alignment unusable on machines with 64k pages [v2]

Ioi Lam iklam at openjdk.java.net
Wed Feb 24 18:48:39 UTC 2021


On Wed, 24 Feb 2021 10:39:46 GMT, Andrew Haley <aph at openjdk.org> wrote:

> > Thanks for review! Currently linux-aarch64, macos-aarch64(I don't know AIX) can be configured with 4K/64K page size. To make one build compatible with both, this change takes the 64K (or bigger) as the default region alignment. It is hard to make it optional I think. Will check the possibility of more options.
> 
> It's not even slightly hard to make it optional. It should be a build-time configure argument. In many cases there is no need to make one build compatible with both 64k and 4k. If you'd like the default to be 64k I'm fine with that, but it should be possible to build with 4k alignment.

How about this. We add a configure option like:

bash configure --with-cds-core-region-alignment=65536

and 

size_t MetaspaceShared::reserved_space_alignment()  {
#ifdef CDS_CORE_REGION_ALIGNMENT
  return CDS_CORE_REGION_ALIGNMENT;
#else 
  os::vm_allocation_granularity();
#endif
}

When we create or map the CDS archive, we need to ensure that the configured value is compatible with `os::vm_allocation_granularity()`, with something like:

if (MetaspaceShared::reserved_space_alignment() < os::vm_allocation_granularity() ||
    (MetaspaceShared::reserved_space_alignment() % os::vm_allocation_granularity()) != 0) {
    fail("CDS is disabled because ......");
}

-------------

PR: https://git.openjdk.java.net/jdk/pull/2651


More information about the hotspot-runtime-dev mailing list