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

Stefan Karlsson stefank at openjdk.org
Tue Apr 23 07:49:40 UTC 2024


On Tue, 23 Apr 2024 06:28:31 GMT, David Holmes <dholmes at openjdk.org> wrote:

>> src/hotspot/share/nmt/virtualMemoryTracker.cpp line 460:
>> 
>>> 458:   assert(_reserved_regions != nullptr, "Sanity check");
>>> 459: 
>>> 460:   ReservedMemoryRegion  rgn(addr, size, flag);
>> 
>> I'm not sure about this. `rgn` is just used to find the memory region we want to uncommit. The flag isn't used in the search, and passing it forces the callers to also pass in the flag.
>> 
>> I understand that this happens after the request to remove the mtNone default value. Is there a way that allows us to skip using mtNone, but still don't have to unnecessarily provide a flag?
>> 
>> Maybe we could create a helper function `ReservedMemoryRegion rgn = ReservedMemoryRegion::create_find_key(addr, size)`, which sets up a ReserveMemoryRegion with mtNone?
>
> Was this comment from Stefan addressed?

David is right, this comment wasn't addressed. The code here went back and forth and we settled on hiding `ReservedMemoryRegion(address base, size_t size)` in a separate RFE. This means we probably should revert the usage of `flag` here and all the places that passes down `flag` just to reach this function.

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

PR Review Comment: https://git.openjdk.org/jdk/pull/18745#discussion_r1575801191


More information about the shenandoah-dev mailing list