RFR: 8236847: CDS archive with 4K alignment unusable on machines with 64k pages [v2]
David Holmes
david.holmes at oracle.com
Wed Feb 24 01:45:16 UTC 2021
On 24/02/2021 10:47 am, Ioi Lam wrote:
> On Tue, 23 Feb 2021 17:50:42 GMT, Ioi Lam <iklam at openjdk.org> wrote:
>> _Mailing list message from [David Holmes](mailto:david.holmes at oracle.com) on [hotspot-runtime-dev](mailto:hotspot-runtime-dev at openjdk.java.net):_
>>
>> On 24/02/2021 3:50 am, Ioi Lam wrote:
>>
>>> On Tue, 23 Feb 2021 17:32:44 GMT, Yumin Qi <minqi at openjdk.org> wrote:
>>>> Is?
>>>> `#if (defined(LINUX) || defined(__APPLE__)) && defined(AARCH64) or #if (defined(LINUX) && defined(AARCH64)) || defined(__APPLE__)`
>>>
>>>
>>> Actually, I think we should use
>>> #if (defined(LINUX) && defined(AARCH64)) || (defined(__APPLE__) && defined(AMD64))`
>>> For the macOS case, we are running an AMD64 binary inside Rosetta.
>>> We don't need to worry about `(defined(__APPLE__) && defined(AARCH64))` because we cannot run M1 binaries on AMD64.
>>
>> I'm confused. Is this about running binaries on different architectures
>> or running binaries on machines with different page sizes? Or both?
>
> The latter.
>
> The macOS case is logically running on the same architecture (AMD64), except one of them is a *real* AMD64, and the second one is emulated AMD64 on M1 silicon. As far as the JVM knows, it runs on AMD64.
Yuck! So we have to use 64K alignment on x86_64 in case it gets run on a M1.
>> If
>> the M1 machines support 4K or 64K then they would need this change - no?
>
> No, M1 macs always use 64KB pages. You cannot execute macOS/aarch64 binaries on macOS/AMD.
At least M1 always being 64KB simplifies things.
>> Regardless I'd rather see this hidden by some abstraction that captures
>> whether a given platform supports multiple sizes rather than these
>> explicit ifdefs.
>
> How about a function like:
>
> os::cds_core_region_alignment()
>
> This function would return 64KB in the affected cases, and os::vm_allocation_granularity() otherwise.
That's fine for runtime. I was actually thinking about a build-time
abstraction like NEEDS_64K_MINIMUM_ALIGNMENT which would be defined by
those platforms that need this.
Thanks,
David
>> Thanks,
>> David
>
> -------------
>
> PR: https://git.openjdk.java.net/jdk/pull/2651
>
More information about the hotspot-runtime-dev
mailing list