Skip to content

8364197: G1: Sort G1 mutex locks by name and group them together #26508

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
28 changes: 16 additions & 12 deletions src/hotspot/share/runtime/mutexLocker.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -97,16 +97,18 @@ Mutex* RawMonitor_lock = nullptr;
Mutex* PerfDataMemAlloc_lock = nullptr;
Mutex* PerfDataManager_lock = nullptr;

#if INCLUDE_G1GC
Monitor* G1CGC_lock = nullptr;
Mutex* G1DetachedRefinementStats_lock = nullptr;
Mutex* G1FreeList_lock = nullptr;
Mutex* G1MarkStackChunkList_lock = nullptr;
Mutex* G1MarkStackFreeList_lock = nullptr;
Monitor* G1OldGCCount_lock = nullptr;
Mutex* G1OldSets_lock = nullptr;
Mutex* G1Uncommit_lock = nullptr;
Monitor* G1RootRegionScan_lock = nullptr;
Monitor* G1OldGCCount_lock = nullptr;
Mutex* G1RareEvent_lock = nullptr;
Mutex* G1DetachedRefinementStats_lock = nullptr;
Mutex* G1MarkStackFreeList_lock = nullptr;
Mutex* G1MarkStackChunkList_lock = nullptr;
#endif

Mutex* Management_lock = nullptr;
Monitor* MonitorDeflation_lock = nullptr;
Expand Down Expand Up @@ -209,19 +211,19 @@ void mutex_init() {

MUTEX_DEFN(STS_lock , PaddedMonitor, nosafepoint);

#if INCLUDE_G1GC
if (UseG1GC) {
MUTEX_DEFN(G1CGC_lock , PaddedMonitor, nosafepoint);

MUTEX_DEFN(G1DetachedRefinementStats_lock, PaddedMutex , nosafepoint-2);

MUTEX_DEFN(G1FreeList_lock , PaddedMutex , service-1);
MUTEX_DEFN(G1MarkStackChunkList_lock , PaddedMutex , nosafepoint);
MUTEX_DEFN(G1MarkStackFreeList_lock , PaddedMutex , nosafepoint);
MUTEX_DEFN(G1OldSets_lock , PaddedMutex , nosafepoint);
MUTEX_DEFN(G1Uncommit_lock , PaddedMutex , service-2);
MUTEX_DEFN(G1RootRegionScan_lock , PaddedMonitor, nosafepoint-1);

MUTEX_DEFN(G1MarkStackFreeList_lock , PaddedMutex , nosafepoint);
MUTEX_DEFN(G1MarkStackChunkList_lock , PaddedMutex , nosafepoint);
MUTEX_DEFN(G1Uncommit_lock , PaddedMutex , service-2);
}
#endif

MUTEX_DEFN(MonitoringSupport_lock , PaddedMutex , service-1); // used for serviceability monitoring support

MUTEX_DEFN(StringDedup_lock , PaddedMonitor, nosafepoint);
Expand Down Expand Up @@ -340,10 +342,12 @@ void mutex_init() {
MUTEX_DEFL(VMOperation_lock , PaddedMonitor, Heap_lock, true);
MUTEX_DEFL(ClassInitError_lock , PaddedMonitor, Threads_lock);

#if INCLUDE_G1GC
if (UseG1GC) {
MUTEX_DEFL(G1OldGCCount_lock , PaddedMonitor, Threads_lock, true);
MUTEX_DEFL(G1RareEvent_lock , PaddedMutex , Threads_lock, true);
MUTEX_DEFL(G1OldGCCount_lock , PaddedMonitor, Threads_lock, true);
MUTEX_DEFL(G1RareEvent_lock , PaddedMutex , Threads_lock, true);
}
#endif

MUTEX_DEFL(CompileTaskWait_lock , PaddedMonitor, MethodCompileQueue_lock);

Expand Down
24 changes: 13 additions & 11 deletions src/hotspot/share/runtime/mutexLocker.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -70,13 +70,7 @@ extern Monitor* Threads_lock; // a lock on the Threads table
// (also used by Safepoints too to block threads creation/destruction)
extern Mutex* NonJavaThreadsList_lock; // a lock on the NonJavaThreads list
extern Mutex* NonJavaThreadsListSync_lock; // a lock for NonJavaThreads list synchronization
extern Monitor* G1CGC_lock; // used for coordination between fore- & background G1 concurrent GC threads.
extern Monitor* STS_lock; // used for joining/leaving SuspendibleThreadSet.
extern Monitor* G1OldGCCount_lock; // in support of "concurrent" full gc
extern Mutex* G1RareEvent_lock; // Synchronizes (rare) parallel GC operations.
extern Mutex* G1DetachedRefinementStats_lock; // Lock protecting detached refinement stats for G1.
extern Mutex* G1MarkStackFreeList_lock; // Protects access to the G1 global mark stack free list.
extern Mutex* G1MarkStackChunkList_lock; // Protects access to the G1 global mark stack chunk list.
extern Mutex* MonitoringSupport_lock; // Protects updates to the serviceability memory pools and allocated memory high water mark.
extern Monitor* ConcurrentGCBreakpoints_lock; // Protects concurrent GC breakpoint management
extern Mutex* Compile_lock; // a lock held when Compilation is updating code (used to block CodeCache traversal, CHA updates, etc)
Expand All @@ -98,14 +92,22 @@ extern Mutex* ExceptionCache_lock; // a lock used to synchronize e
extern Mutex* FullGCALot_lock; // a lock to make FullGCALot MT safe
#endif // PRODUCT

extern Mutex* RawMonitor_lock;
extern Mutex* PerfDataMemAlloc_lock; // a lock on the allocator for PerfData memory for performance data
extern Mutex* PerfDataManager_lock; // a long on access to PerfDataManager resources

#if INCLUDE_G1GC
extern Monitor* G1CGC_lock; // used for coordination between fore- & background G1 concurrent GC threads.
extern Mutex* G1DetachedRefinementStats_lock; // Lock protecting detached refinement stats for G1.
extern Mutex* G1FreeList_lock; // protects the G1 free region list during safepoints
extern Mutex* G1MarkStackChunkList_lock; // Protects access to the G1 global mark stack chunk list.
extern Mutex* G1MarkStackFreeList_lock; // Protects access to the G1 global mark stack free list.
extern Monitor* G1OldGCCount_lock; // in support of "concurrent" full gc
extern Mutex* G1OldSets_lock; // protects the G1 old region sets
extern Mutex* G1Uncommit_lock; // protects the G1 uncommit list when not at safepoints
extern Mutex* G1RareEvent_lock; // Synchronizes (rare) parallel GC operations.
extern Monitor* G1RootRegionScan_lock; // used to notify that the G1 CM threads have finished scanning the root regions
extern Mutex* G1Uncommit_lock; // protects the G1 uncommit list when not at safepoints
#endif

extern Mutex* RawMonitor_lock;
extern Mutex* PerfDataMemAlloc_lock; // a lock on the allocator for PerfData memory for performance data
extern Mutex* PerfDataManager_lock; // a long on access to PerfDataManager resources

extern Mutex* Management_lock; // a lock used to serialize JVM management
extern Monitor* MonitorDeflation_lock; // a lock used for monitor deflation thread operation
Expand Down