8049304: race between VM_Exit and _sync_FutileWakeups->inc()

Add PerfDataManager.has_PerfData() to indicate when PerfData objects should be safe to query. Update Java monitor PerfData usage to check the new flag. PerfDataManager::destroy() should only be called at a safepoint and when the StatSampler is not active.

Reviewed-by: kbarrett, dholmes, tbenson, bdelsart
This commit is contained in:
Daniel D. Daugherty 2015-09-03 10:22:39 -07:00
parent c091c7348a
commit 9b12926ed8
6 changed files with 57 additions and 39 deletions

View file

@ -189,9 +189,7 @@ bool ObjectSynchronizer::quick_notify(oopDesc * obj, Thread * self, bool all) {
mon->INotify(self);
++tally;
} while (mon->first_waiter() != NULL && all);
if (ObjectMonitor::_sync_Notifications != NULL) {
ObjectMonitor::_sync_Notifications->inc(tally);
}
OM_PERFDATA_OP(Notifications, inc(tally));
}
return true;
}
@ -1413,7 +1411,7 @@ ObjectMonitor * NOINLINE ObjectSynchronizer::inflate(Thread * Self,
// Hopefully the performance counters are allocated on distinct cache lines
// to avoid false sharing on MP systems ...
if (ObjectMonitor::_sync_Inflations != NULL) ObjectMonitor::_sync_Inflations->inc();
OM_PERFDATA_OP(Inflations, inc());
TEVENT(Inflate: overwrite stacklock);
if (TraceMonitorInflation) {
if (object->is_instance()) {
@ -1461,7 +1459,7 @@ ObjectMonitor * NOINLINE ObjectSynchronizer::inflate(Thread * Self,
// Hopefully the performance counters are allocated on distinct
// cache lines to avoid false sharing on MP systems ...
if (ObjectMonitor::_sync_Inflations != NULL) ObjectMonitor::_sync_Inflations->inc();
OM_PERFDATA_OP(Inflations, inc());
TEVENT(Inflate: overwrite neutral);
if (TraceMonitorInflation) {
if (object->is_instance()) {
@ -1678,8 +1676,8 @@ void ObjectSynchronizer::deflate_idle_monitors() {
}
Thread::muxRelease(&gListLock);
if (ObjectMonitor::_sync_Deflations != NULL) ObjectMonitor::_sync_Deflations->inc(nScavenged);
if (ObjectMonitor::_sync_MonExtant != NULL) ObjectMonitor::_sync_MonExtant ->set_value(nInCirculation);
OM_PERFDATA_OP(Deflations, inc(nScavenged));
OM_PERFDATA_OP(MonExtant, set_value(nInCirculation));
// TODO: Add objectMonitor leak detection.
// Audit/inventory the objectMonitors -- make sure they're all accounted for.