mirror of
https://github.com/openjdk/jdk.git
synced 2025-09-18 01:54:47 +02:00
8181859: Monitor deflation is not checked in cleanup path
Reviewed-by: sspitsyn, dcubed, shade, cvarming
This commit is contained in:
parent
2a0bd0cd04
commit
0d3624a309
4 changed files with 25 additions and 1 deletions
|
@ -1184,6 +1184,12 @@ public:
|
|||
\
|
||||
product(bool, MonitorInUseLists, true, "Track Monitors for Deflation") \
|
||||
\
|
||||
experimental(intx, MonitorUsedDeflationThreshold, 90, \
|
||||
"Percentage of used monitors before triggering cleanup " \
|
||||
"safepoint which deflates monitors (0 is off). " \
|
||||
"The check is performed on GuaranteedSafepointInterval.") \
|
||||
range(0, 100) \
|
||||
\
|
||||
experimental(intx, SyncFlags, 0, "(Unsafe, Unstable) " \
|
||||
"Experimental Sync flags") \
|
||||
\
|
||||
|
|
|
@ -525,6 +525,8 @@ void SafepointSynchronize::end() {
|
|||
}
|
||||
|
||||
bool SafepointSynchronize::is_cleanup_needed() {
|
||||
// Need a safepoint if there are many monitors to deflate.
|
||||
if (ObjectSynchronizer::is_cleanup_needed()) return true;
|
||||
// Need a safepoint if some inline cache buffers is non-empty
|
||||
if (!InlineCacheBuffer::is_empty()) return true;
|
||||
return false;
|
||||
|
|
|
@ -962,6 +962,21 @@ static inline ObjectMonitor* next(ObjectMonitor* block) {
|
|||
return block;
|
||||
}
|
||||
|
||||
static bool monitors_used_above_threshold() {
|
||||
if (gMonitorPopulation == 0) {
|
||||
return false;
|
||||
}
|
||||
int monitors_used = gMonitorPopulation - gMonitorFreeCount;
|
||||
int monitor_usage = (monitors_used * 100LL) / gMonitorPopulation;
|
||||
return monitor_usage > MonitorUsedDeflationThreshold;
|
||||
}
|
||||
|
||||
bool ObjectSynchronizer::is_cleanup_needed() {
|
||||
if (MonitorUsedDeflationThreshold > 0) {
|
||||
return monitors_used_above_threshold();
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
void ObjectSynchronizer::oops_do(OopClosure* f) {
|
||||
if (MonitorInUseLists) {
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* Copyright (c) 1998, 2016, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 1998, 2017, Oracle and/or its affiliates. All rights reserved.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
|
@ -135,6 +135,7 @@ class ObjectSynchronizer : AllStatic {
|
|||
static bool deflate_monitor(ObjectMonitor* mid, oop obj,
|
||||
ObjectMonitor** freeHeadp,
|
||||
ObjectMonitor** freeTailp);
|
||||
static bool is_cleanup_needed();
|
||||
static void oops_do(OopClosure* f);
|
||||
// Process oops in thread local used monitors
|
||||
static void thread_local_used_oops_do(Thread* thread, OopClosure* f);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue