RFR: 8366658: Add missing locks when accessing the VirtualMemoryTracker instance in tests and MemMapPrinter
Johan Sjölen
jsjolen at openjdk.org
Thu Sep 11 10:14:53 UTC 2025
On Tue, 2 Sep 2025 07:07:51 GMT, Johan Sjölen <jsjolen at openjdk.org> wrote:
> Hi,
>
> This PR adds the missing locks for the tests and MemMapPrinter, also fixes a small bug in `walk_virtual_memory`. See inline review comments.
>
> Passes tier1.
src/hotspot/share/nmt/memTracker.hpp line 182:
> 180: return VirtualMemoryTracker::Instance::walk_virtual_memory(walker);
> 181: }
> 182:
Added this so that we can do the usual checks and lock taking in the place where we typically take the lock.
src/hotspot/share/nmt/virtualMemoryTracker.cpp line 221:
> 219: });
> 220: return ret;
> 221: }
A VirtualMemoryWalker returned true or false depending on whether or not its operation succeeded, and we are meant to pass that along as the return value of walk_virtual_memory. That was missing, now fixed.
src/hotspot/share/nmt/virtualMemoryTracker.hpp line 349:
> 347: public:
> 348: virtual bool do_allocation_site(const ReservedMemoryRegion* rgn) { return false; }
> 349: };
Indentation fix
test/hotspot/gtest/runtime/test_virtualMemoryTracker.cpp line 63:
> 61: LOG("In reserved region " PTR_FORMAT ", size %X:", p2i(rmr.base()), rmr.size());
> 62: vmt.tree()->visit_committed_regions(rmr, [&](CommittedMemoryRegion& region) {
> 63: LOG(" committed region: " PTR_FORMAT ", size %X", p2i(region.base()), region.size());
Here the VMT was passed along but never actually used for printing
-------------
PR Review Comment: https://git.openjdk.org/jdk/pull/27038#discussion_r2321147605
PR Review Comment: https://git.openjdk.org/jdk/pull/27038#discussion_r2321146800
PR Review Comment: https://git.openjdk.org/jdk/pull/27038#discussion_r2321143077
PR Review Comment: https://git.openjdk.org/jdk/pull/27038#discussion_r2321144236
More information about the hotspot-runtime-dev
mailing list