RFR: 8331539: [REDO] NMT: add/make a mandatory MEMFLAGS argument to family of os::reserve/commit/uncommit memory API [v2]
Stefan Karlsson
stefank at openjdk.org
Fri May 24 10:17:04 UTC 2024
On Fri, 24 May 2024 09:12:16 GMT, Afshin Zafari <azafari at openjdk.org> wrote:
>> src/hotspot/share/cds/metaspaceShared.cpp line 1088:
>>
>>> 1086: #endif // ASSERT
>>> 1087:
>>> 1088: if (archive_space_rs.is_reserved()) {
>>
>> We've already asserted that this should be true, so this if should not be needed.
>
> I had to add these, since the `log_info(cds)` calls caused the assertions in the `ReservedSpace` getters raised (IIRC, even during jdk-build).
Can you show the error message?
>> src/hotspot/share/cds/metaspaceShared.cpp line 1370:
>>
>>> 1368: ccs_begin_offset, mtClassShared, mtClass);
>>> 1369: }
>>> 1370: assert(archive_space_rs.is_reserved(), "Archive space is not reserved.");
>>
>> Something is dubious about the code above:
>>
>> archive_space_rs = total_space_rs.first_part(ccs_begin_offset,
>> (size_t)archive_space_alignment);
>> class_space_rs = total_space_rs.last_part(ccs_begin_offset);
>> MemTracker::record_virtual_memory_split_reserved(total_space_rs.base(), total_space_rs.size(),
>> ccs_begin_offset, mtClassShared, mtClass);
>>
>>
>> In one path `total_space_rs` gets initialized with `mtClass` and in another path it gets initialized with `mtClassShared`. This means that we always get the wrong flag in one of `archive_space_rs` and `class_space_rs`.
>
> The logic is that, a large region `total_space_rs` is reserved and then is split into two sub regions. It doesn't matter what is the flag for `total_space_rs`. At split time the flags are set correctly for sub regions.
The flags sent to the NMT subsystem is correct, but the flags recorded in the ReservedSpaces will be wrong, AFAIKT. You can probably verify that by adding asserts.
-------------
PR Review Comment: https://git.openjdk.org/jdk/pull/19343#discussion_r1613235966
PR Review Comment: https://git.openjdk.org/jdk/pull/19343#discussion_r1613237903
More information about the shenandoah-dev
mailing list