RFR: 8331539: [REDO] NMT: add/make a mandatory MEMFLAGS argument to family of os::reserve/commit/uncommit memory API [v2]

Afshin Zafari azafari at openjdk.org
Fri May 24 09:29:02 UTC 2024


On Thu, 23 May 2024 12:30:41 GMT, Stefan Karlsson <stefank at openjdk.org> wrote:

>> Afshin Zafari has updated the pull request incrementally with one additional commit since the last revision:
>> 
>>   fixed the missing parts of shenandoahHeap.cpp
>
> 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.

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

PR Review Comment: https://git.openjdk.org/jdk/pull/19343#discussion_r1613171792


More information about the shenandoah-dev mailing list