RFR: 8362276: NMT tests should have locks for the entire tests [v2]

Coleen Phillimore coleenp at openjdk.org
Wed Jul 16 11:19:41 UTC 2025


On Tue, 15 Jul 2025 22:48:30 GMT, Gerard Ziemski <gziemski at openjdk.org> wrote:

>> We restructure the code to make sure we cover the code that uses the global tree instance (but nothing else that uses the same lock internally) as needed:
>> 
>> - we move MemoryReserver::reserve() to the top to do as the first thing
>> - we grab the MemTracker::NmtVirtualMemoryLocker nvml
>> - do all the usual test stuff, including checking, which grabs the global instance of the tree
>> - we move remove_all() to the very bottom to do as the last thing
>> 
>> Testing: runnig Mach5 tier1-4 right now...
>
> Gerard Ziemski has updated the pull request incrementally with one additional commit since the last revision:
> 
>   restructure code to make sure we use the lock as needed

test/hotspot/gtest/runtime/test_virtualMemoryTracker.cpp line 441:

> 439:     ReservedSpace rs = MemoryReserver::reserve(size, mtTest);
> 440: 
> 441:     RegionsTree* rtree = VirtualMemoryTracker::Instance::tree();

I have to confess to not paying attention to this change, but shouldn't you fetch the tree under the lock also?

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

PR Review Comment: https://git.openjdk.org/jdk/pull/26324#discussion_r2210054025


More information about the hotspot-runtime-dev mailing list