On Mon, 28 Oct 2024 15:45:31 GMT, Robert Toyonaga <d...@openjdk.org> wrote:

>> src/hotspot/share/runtime/mutexLocker.cpp line 299:
>> 
>>> 297:   MUTEX_DEFN(ThreadsSMRDelete_lock           , PaddedMonitor, 
>>> service-2); // Holds ConcurrentHashTableResize_lock
>>> 298:   MUTEX_DEFN(ThreadIdTableCreate_lock        , PaddedMutex  , 
>>> safepoint);
>>> 299:   MUTEX_DEFN(SharedDecoder_lock              , PaddedMutex  , 
>>> service-5);
>> 
>> Why this? Do we print stacks under NMT lock protection?
>
> Yes I think so. `MemTracker::print_containing_region` first acquires the  NMT 
> lock then the `SharedDecoder_lock` like this:
> 
> `MemTracker::print_containing_region` -->
> `PrintRegionWalker::do_allocation_site` -->
> `NativeCallStack::print_frame` --> 
> `Decoder::get_source_info` --> 
> `Decoder::shared_decoder_lock()`

Otherwise `make test TEST=hotspot_nmt` throws a lock rank error when running 
the test  `location_printing_mmap_1`. That test uses 
`MemTracker::print_containing_region`.

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

PR Review Comment: https://git.openjdk.org/jdk/pull/20852#discussion_r1819316109

Reply via email to