8181859: Monitor deflation is not checked in cleanup path

Reviewed-by: sspitsyn, dcubed, shade, cvarming
This commit is contained in:
Robbin Ehn 2017-06-15 09:52:44 +02:00
parent 2a0bd0cd04
commit 0d3624a309
4 changed files with 25 additions and 1 deletions

View file

@ -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) {