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

David Holmes dholmes at openjdk.org
Tue Apr 23 06:34:35 UTC 2024


On Fri, 19 Apr 2024 09:49:33 GMT, Afshin Zafari <azafari at openjdk.org> wrote:

>> `MEMFLAGS flag` is used to hold/show the type of the memory regions in NMT. Each call of NMT API requires a search through the list of memory regions.
>> The Hotspot code reserves/commits/uncommits memory regions and later calls explicitly NMT API with a specific memory type (e.g., `mtGC`, `mtJavaHeap`) for that region.  Therefore, there are two search in the list of regions per reserve/commit/uncommit operations, one for the operation and another for setting the type of the region.  
>> When the memory type is passed in during reserve/commit/uncommit operations, NMT can use it and avoid the extra search for setting the memory type.
>> 
>> Tests: tiers1-5 passed on linux-x64, macosx-aarch64 and windows-x64 for debug and non-debug builds.
>
> Afshin Zafari has updated the pull request incrementally with one additional commit since the last revision:
> 
>   removed extra blank line.

This is a big change, but the pattern of the changes is quite easy to follow.

I do have a couple of queries below.

Thanks

src/hotspot/share/cds/metaspaceShared.cpp line 1332:

> 1330:     // NMT: fix up the space tags
> 1331:     MemTracker::record_virtual_memory_type(archive_space_rs.base(), mtClassShared);
> 1332:     MemTracker::record_virtual_memory_type(class_space_rs.base(), mtClass);

I assumed these (and others) were removed because the `MemTracker` updates had been pushed down into `ReserveSpace` itself, but I can't find them there - what am I missing?

src/hotspot/share/gc/parallel/mutableSpace.cpp line 63:

> 61:       if (clear_space) {
> 62:         // Prefer page reallocation to migration.
> 63:         os::free_memory((char*)start, size, page_size, mtGC);

Not at all obvious where the corresponding allocation sets the type as mtGC. ??

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

PR Review: https://git.openjdk.org/jdk/pull/18745#pullrequestreview-2016320972
PR Review Comment: https://git.openjdk.org/jdk/pull/18745#discussion_r1575693287
PR Review Comment: https://git.openjdk.org/jdk/pull/18745#discussion_r1575697729


More information about the shenandoah-dev mailing list