RFR: 8362276: NMT tests should have locks for the entire tests [v2]
Coleen Phillimore
coleenp at openjdk.org
Wed Jul 16 13:12:42 UTC 2025
On Wed, 16 Jul 2025 11:23:31 GMT, Aleksey Shipilev <shade at openjdk.org> wrote:
>> 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?
>
> I wondered the same, but this just returns an (unchanging) pointer. We are not in this locking game to ensure memory ordering, we only need mutual exclusion here. So IMO it does not matter for correctness whether we pull this under the lock or not.
>
> Would be cleaner to do _everything_ under the lock, but this seems fine as well.
Okay, I see that too. The code just made me wonder but it's okay.
-------------
PR Review Comment: https://git.openjdk.org/jdk/pull/26324#discussion_r2210381637
More information about the hotspot-runtime-dev
mailing list