RFR: 8366363: MemBaseline accesses VMT without using lock [v10]

Afshin Zafari azafari at openjdk.org
Tue Sep 2 13:58:10 UTC 2025


On Tue, 2 Sep 2025 13:30:59 GMT, Johan Sjölen <jsjolen at openjdk.org> wrote:

>> Hi,
>> 
>> The `MemBaseline` used to access the VMT instance directly without a lock. We fix that, and we switch from using a `LinkedList` to a copied `RegionsTree` instead.
>
> Johan Sjölen has updated the pull request incrementally with one additional commit since the last revision:
> 
>   After a lot of casting

src/hotspot/share/nmt/memBaseline.cpp line 175:

> 173:   VirtualMemoryAllocationSite* site;
> 174:   bool failed_oom = false;
> 175:   _vma_allocs_replacement->visit_reserved_regions([&](ReservedMemoryRegion& rgn) {

The `_vma_allocs_replacement` is used only locally here. Instead of creating a copy of the VMATree, we can do our loop here within a lock. Can't we?
Then we save one tree traverse.

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

PR Review Comment: https://git.openjdk.org/jdk/pull/27003#discussion_r2316165798


More information about the hotspot-dev mailing list