From 6db1c4f5b93a1b7f7d9da36745dc433c9985a169 Mon Sep 17 00:00:00 2001 From: Coleen Phillimore Date: Thu, 4 Dec 2025 22:34:42 +0000 Subject: [PATCH] 8371409: Wrong lock ordering between FullGCALot_lock and ThreadsLockThrottle_lock/MethodCompileQueue_lock Reviewed-by: rehn, pchilanomate --- src/hotspot/share/memory/universe.cpp | 4 ++-- src/hotspot/share/runtime/mutexLocker.cpp | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/src/hotspot/share/memory/universe.cpp b/src/hotspot/share/memory/universe.cpp index 4d2897be5eb..cfbab1b8afb 100644 --- a/src/hotspot/share/memory/universe.cpp +++ b/src/hotspot/share/memory/universe.cpp @@ -544,7 +544,7 @@ void Universe::genesis(TRAPS) { // Only modify the global variable inside the mutex. // If we had a race to here, the other dummy_array instances // and their elements just get dropped on the floor, which is fine. - MutexLocker ml(THREAD, FullGCALot_lock); + MutexLocker ml(THREAD, FullGCALot_lock, Mutex::_no_safepoint_check_flag); if (_fullgc_alot_dummy_array.is_empty()) { _fullgc_alot_dummy_array = OopHandle(vm_global(), dummy_array()); } @@ -1458,7 +1458,7 @@ uintptr_t Universe::verify_mark_bits() { #ifdef ASSERT // Release dummy object(s) at bottom of heap bool Universe::release_fullgc_alot_dummy() { - MutexLocker ml(FullGCALot_lock); + MutexLocker ml(FullGCALot_lock, Mutex::_no_safepoint_check_flag); objArrayOop fullgc_alot_dummy_array = (objArrayOop)_fullgc_alot_dummy_array.resolve(); if (fullgc_alot_dummy_array != nullptr) { if (_fullgc_alot_dummy_next >= fullgc_alot_dummy_array->length()) { diff --git a/src/hotspot/share/runtime/mutexLocker.cpp b/src/hotspot/share/runtime/mutexLocker.cpp index 5d7e310fb11..b102e6424f1 100644 --- a/src/hotspot/share/runtime/mutexLocker.cpp +++ b/src/hotspot/share/runtime/mutexLocker.cpp @@ -244,7 +244,7 @@ void mutex_init() { MUTEX_DEFN(SymbolArena_lock , PaddedMutex , nosafepoint); MUTEX_DEFN(ExceptionCache_lock , PaddedMutex , safepoint); #ifndef PRODUCT - MUTEX_DEFN(FullGCALot_lock , PaddedMutex , safepoint); // a lock to make FullGCALot MT safe + MUTEX_DEFN(FullGCALot_lock , PaddedMutex , nosafepoint); // a lock to make FullGCALot MT safe #endif MUTEX_DEFN(BeforeExit_lock , PaddedMonitor, safepoint);