RFR(L) 8231610 Relocate the CDS archive if it cannot be mapped to the requested address

Thomas Stüfe thomas.stuefe at gmail.com
Thu Oct 17 16:30:49 UTC 2019

Hi Ioi,

nice work!

I had a look at the your changes - not a thorough review yet, I plan to
take a deeper look next week.

One small note, I am working on
https://bugs.openjdk.java.net/browse/JDK-8221173 (prototype is already
alive and well in jdk-sandbox), and the only issue which might creep up is
that my work would increase Metaspace reserve alignment to a much larger
value (4m). This was also the reason for JDK-8230645
<https://bugs.openjdk.java.net/browse/JDK-8230645>. But to me it looks like
your patch handles this just fine - I combed the initialization code, and
it should work with larger values of Metaspace reserve alignment as long as
it is aligned to allocation granularity?

I also was working on a patch to disentangle metaspace reserve alignment
from CDS archive alignment - because CDS archives should not be hostage to
a larger metaspace reserve alignment - but you were faster and I will just
hold my work until your patch is through.

Kind Regards, Thomas

On Fri, Oct 11, 2019 at 3:00 AM Ioi Lam <ioi.lam at oracle.com> wrote:

> Bug:
> https://bugs.openjdk.java.net/browse/JDK-8231610
> Webrev:
> http://cr.openjdk.java.net/~iklam/jdk14/8231610-relocate-cds-archive.v01/
> Design:
> http://cr.openjdk.java.net/~iklam/jdk14/design/8231610-relocate-cds-archive.txt
> Overview:
> The CDS archive is mmaped to a fixed address range (starting at
> SharedBaseAddress, usually 0x800000000). Previously, if this
> requested address range is not available (usually due to Address
> Space Layout Randomization (ASLR) [2]), the JVM will give up and
> will load classes dynamically using class files.
> [a] This causes slow down in JVM start-up.
> [b] Handling of mapping failures causes unnecessary complication in
>      the CDS tests.
> Here are some preliminary benchmarking results (using default CDS archive,
> running helloworld):
> (a) 47.1ms (CDS enabled, mapped at requested addr)
> (b) 53.8ms (CDS enabled, mapped at alternate addr)
> (c) 86.2ms (CDS disabled)
> The small degradation in (b) is caused by the relocation of
> absolute pointers embedded in the CDS archive. However, it is
> still a big improvement over case (c)
> Please see the design doc (link above) for details.
> Thanks
> - Ioi

More information about the hotspot-runtime-dev mailing list