RFR: 8261029: Code heap page sizes not traced correctly using os::trace_page_sizes

Thomas Stuefe stuefe at openjdk.java.net
Wed Feb 10 06:48:37 UTC 2021


On Tue, 9 Feb 2021 13:45:38 GMT, Stefan Johansson <sjohanss at openjdk.org> wrote:

> When adding a code heap the page size used with the underlying mapping is traced using `os::trace_page_sizes`. The old code tried to estimate the page-size based on the size, but the mapping has already been done so it is better to check the passed in `ReservedSpace`. Today we don't record the page size in the ReservedSpace, but we have a helper to do a good estimate: `ReservedSpace::actual_reserved_page_size()`. The proposal is to use this function.
> 
> When changing this I also realized that the traced min-size used un-aligned value while the actual `initialize`-call correctly uses the aligned size. Changed so that we also use the aligned size for tracing.
> 
> I'm currently doing some more work in this area and while I haven't added a specific test for this issue I have created a test I plan to integrate separately when a few more needed changes have gone in. The test is Linux-only and validates the output from `os::trace_page_sizes` against the information in `/proc/self/smaps`.

Hi Stefan,

I think this is okay if we keep in mind that `ReservedSpace::actual_reserved_page_size` needs fixing up. At the latest after JDK-8256155 hits. Rather use one function than to have to hunt down all the places where caller code tries to guess the page size.

Are you currently working on this? If yes, what are your plans? I have a half finished prototype where I changed os::reserve_xxx() to return meta information about the reservation alongside the pointer, one of them the reserved page size.

Have you guys decided whether its okay to remove the "multiple page sizes per reservation" feature?

There is also another possible simplification I was thinking about, which is to remove the "UseSHM" feature from Linux. I honestly do not know why we still need it. That would simplify rework of large page handling on Linux a lot. I did ask around in December: https://mail.openjdk.java.net/pipermail/hotspot-dev/2020-December/046885.html , but did not get many answers.

Cheers, Thomas

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

Marked as reviewed by stuefe (Reviewer).

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


More information about the hotspot-compiler-dev mailing list