RFR: 8346005: Parallel: Incorrect page size calculation with UseLargePages [v11]

Joel Sikström jsikstro at openjdk.org
Fri Oct 10 11:38:07 UTC 2025


On Fri, 10 Oct 2025 10:24:19 GMT, Albert Mingkun Yang <ayang at openjdk.org> wrote:

>> Refactor the heap-space and OS memory interface code to clearly separate two related but distinct concepts: `alignment` and `os-page-size`. These are now represented as two fields in `PSVirtualSpace`.
>> 
>> The parallel heap consists of four spaces: old, eden, from, and to. The first belongs to the old generation, while the latter three belong to the young generation.
>> 
>> The size of any space is always aligned to `alignment`, which also determines the unit for resizing. To keep the implementation simple while allowing flexible per-space commit and uncommit operations, each space must contain at least one OS page. As a result, `alignment` is always greater than or equal to `os-page-size`.
>> 
>> When using explicit large pages -- which require pre-allocating large pages before the VM starts -- the actual OS page size is not known until the heap has been reserved. The additional logic in `ParallelScavengeHeap::initialize` detects the OS page size in use and adjusts `alignment` if necessary.
>> 
>> Test: tier1–8
>
> Albert Mingkun Yang has updated the pull request with a new target base due to a merge or a rebase. The incremental webrev excludes the unrelated changes brought in by the merge/rebase. The pull request contains 15 additional commits since the last revision:
> 
>  - Merge branch 'master' into pgc-largepage
>  - Merge branch 'master' into pgc-largepage
>  - review
>  - Merge branch 'master' into pgc-largepage
>  - review
>  - review
>  - review
>  - Merge branch 'master' into pgc-largepage
>  - Merge branch 'master' into pgc-largepage
>  - Merge branch 'master' into pgc-largepage
>  - ... and 5 more: https://git.openjdk.org/jdk/compare/edcedec4...dca26616

I have a few small comments, but I think this looks pretty good now.

src/hotspot/share/gc/parallel/mutableNUMASpace.cpp line 368:

> 366:         new_region = MemRegion(ps->end(), end());
> 367:       }
> 368:     }

This is technically fine, but maybe we can combine the else and the if to something like below to fit better with the comments?

if (i == 0) { // Bottom chunk
...
} else if (i < lgrp_spaces()->length() - 1) { // Middle chunks
...
} else { // Top chunk
...
}

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

PR Review: https://git.openjdk.org/jdk/pull/26700#pullrequestreview-3309512696
PR Review Comment: https://git.openjdk.org/jdk/pull/26700#discussion_r2419401651


More information about the hotspot-dev mailing list