RFR: 8356233: NMT: tty->print_cr should not be used in VirtualMemoryTracker::add_reserved_region()
David Holmes
dholmes at openjdk.org
Tue May 20 10:21:55 UTC 2025
On Tue, 20 May 2025 06:59:45 GMT, Johan Sjölen <jsjolen at openjdk.org> wrote:
>> To help with debugging NMT we added more info when an assert gets triggered, but we used `tty`, which is involved with locks and unfortunately it triggered:
>>
>>
>> # Internal Error (.../open/src/hotspot/share/runtime/mutex.cpp:457), pid=1088443, tid=1088520
>> # assert(false) failed: Attempting to acquire lock tty_lock/tty out of order with lock NmtVirtualMemory_lock/service-4 -- possible deadlock
>>
>>
>> We avoid this, by printing using `UL` instead of using `tty` directly.
>
> src/hotspot/share/nmt/virtualMemoryTracker.cpp line 411:
>
>> 409: " new region: [" INTPTR_FORMAT "-" INTPTR_FORMAT "), memory tag %s.",
>> 410: p2i(reserved_rgn->base()), p2i(reserved_rgn->end()), NMTUtil::tag_to_name(mem_tag_old),
>> 411: p2i(base_addr), p2i(base_addr + size), NMTUtil::tag_to_name(mem_tag_new));
>
> This change also now prints the name instead of the index. If you do print the name, then you don't need to use `index_to_tag` as they already are `MemTag`s.
+1 on Johan's comment
-------------
PR Review Comment: https://git.openjdk.org/jdk/pull/25308#discussion_r2097585561
More information about the hotspot-runtime-dev
mailing list