RFR: 8346005: Parallel: Incorrect page size calculation with UseLargePages [v6]
Joel Sikström
jsikstro at openjdk.org
Fri Oct 3 14:33:10 UTC 2025
On Thu, 2 Oct 2025 09:52:50 GMT, Albert Mingkun Yang <ayang at openjdk.org> wrote:
>> src/hotspot/share/gc/parallel/parallelArguments.cpp line 131:
>>
>>> 129: if (page_sz == os::vm_page_size()) {
>>> 130: log_warning(gc, heap)("MinHeapSize (%zu) must be large enough for 4 * page-size; Disabling UseLargePages for heap", MinHeapSize);
>>> 131: return;
>>
>> Wouldn't it make sense to do `FLAG_SET_ERGO(UseLargepages, false)` here since it is effectively disabled.
>
> There are non-heap uses of `UseLargePages` as well. Here we concluded heap can't use large-page, but other systems still can.
I see, thank you.
>> src/hotspot/share/gc/parallel/parallelArguments.cpp line 137:
>>
>>> 135: assert(is_power_of_2((intptr_t)page_sz), "must be a power of 2");
>>> 136: // Space is largepage-aligned.
>>> 137: size_t new_alignment = page_sz;
>>
>> To me it looks like new_alignment will always be different from SpaceAlignment here. We could simplify this to the following:
>>
>>
>> SpaceAlignment = page_sz;
>>
>> // Redo everything from the start
>> initialize_heap_flags_and_sizes_one_pass();
>
>> To me it looks like new_alignment will always be different from SpaceAlignment here.
>
> Why so? (I know the default value of SpaceAlignment is 64K*8 bytes, which is not a common large-page-size, but that info is not directly accessible in this context.)
We discussed this offline, but if `default_space_alignment()` ever coincided with a Large page size, say 2MB, and 2MB large pages are chosen, SpaceAlignment would still be equal to `default_space_alignment()` and we would end up reserving small pages in `ParallelScavengeHeap::initialize()`.
-------------
PR Review Comment: https://git.openjdk.org/jdk/pull/26700#discussion_r2402168281
PR Review Comment: https://git.openjdk.org/jdk/pull/26700#discussion_r2402167659
More information about the hotspot-gc-dev
mailing list