diff --git a/src/hotspot/share/runtime/lightweightSynchronizer.cpp b/src/hotspot/share/runtime/lightweightSynchronizer.cpp index 55d4a0c30f3d5..7e38ad6d52f1d 100644 --- a/src/hotspot/share/runtime/lightweightSynchronizer.cpp +++ b/src/hotspot/share/runtime/lightweightSynchronizer.cpp @@ -39,7 +39,6 @@ #include "runtime/mutexLocker.hpp" #include "runtime/objectMonitor.inline.hpp" #include "runtime/os.hpp" -#include "runtime/perfData.inline.hpp" #include "runtime/safepointMechanism.inline.hpp" #include "runtime/safepointVerifiers.hpp" #include "runtime/synchronizer.inline.hpp" @@ -384,9 +383,6 @@ ObjectMonitor* LightweightSynchronizer::get_or_insert_monitor(oop object, JavaTh ObjectMonitor* monitor = get_or_insert_monitor_from_table(object, current, &inserted); if (inserted) { - // Hopefully the performance counters are allocated on distinct - // cache lines to avoid false sharing on MP systems ... - OM_PERFDATA_OP(Inflations, inc()); log_inflate(current, object, cause); if (event.should_commit()) { post_monitor_inflate_event(&event, object, cause); @@ -874,9 +870,6 @@ ObjectMonitor* LightweightSynchronizer::inflate_into_object_header(oop object, O // with the ObjectMonitor, it is safe to allow async deflation: ObjectSynchronizer::_in_use_list.add(monitor); - // Hopefully the performance counters are allocated on distinct - // cache lines to avoid false sharing on MP systems ... - OM_PERFDATA_OP(Inflations, inc()); log_inflate(current, object, cause); if (event.should_commit()) { post_monitor_inflate_event(&event, object, cause); @@ -915,9 +908,6 @@ ObjectMonitor* LightweightSynchronizer::inflate_into_object_header(oop object, O // with the ObjectMonitor, it is safe to allow async deflation: ObjectSynchronizer::_in_use_list.add(m); - // Hopefully the performance counters are allocated on distinct - // cache lines to avoid false sharing on MP systems ... - OM_PERFDATA_OP(Inflations, inc()); log_inflate(current, object, cause); if (event.should_commit()) { post_monitor_inflate_event(&event, object, cause); diff --git a/src/hotspot/share/runtime/objectMonitor.cpp b/src/hotspot/share/runtime/objectMonitor.cpp index 42b20b27d28ff..75181ab71cff5 100644 --- a/src/hotspot/share/runtime/objectMonitor.cpp +++ b/src/hotspot/share/runtime/objectMonitor.cpp @@ -49,7 +49,6 @@ #include "runtime/objectMonitor.inline.hpp" #include "runtime/orderAccess.hpp" #include "runtime/osThread.hpp" -#include "runtime/perfData.hpp" #include "runtime/safefetch.hpp" #include "runtime/safepointMechanism.inline.hpp" #include "runtime/sharedRuntime.hpp" @@ -612,8 +611,6 @@ void ObjectMonitor::enter_with_contention_mark(JavaThread *current, ObjectMonito current->post_vthread_pinned_event(&vthread_pinned_event, "Contended monitor enter", result); } } - - OM_PERFDATA_OP(ContendedLockAttempts, inc()); } // Caveat: TryLock() is not necessarily serializing if it returns failure. @@ -941,14 +938,6 @@ void ObjectMonitor::EnterI(JavaThread* current) { // The lock is still contested. - // Keep a tally of the # of futile wakeups. - // Note that the counter is not protected by a lock or updated by atomics. - // That is by design - we trade "lossy" counters which are exposed to - // races during updates for a lower probe effect. - // We are in safepoint safe state, so shutdown can remove the counter - // under our feet. Make sure we make this access safely. - OM_PERFDATA_SAFE_OP(FutileWakeups, inc()); - // Assuming this is not a spurious wakeup we'll normally find _succ == current. // We can defer clearing _succ until after the spin completes // TrySpin() must tolerate being called with _succ == current. @@ -1069,12 +1058,6 @@ void ObjectMonitor::ReenterI(JavaThread* current, ObjectWaiter* currentNode) { // Invariant: after clearing _succ a contending thread // *must* retry _owner before parking. OrderAccess::fence(); - - // Keep a tally of the # of futile wakeups. - // Note that the counter is not protected by a lock or updated by atomics. - // That is by design - we trade "lossy" counters which are exposed to - // races during updates for a lower probe effect. - OM_PERFDATA_OP(FutileWakeups, inc()); } // current has acquired the lock -- Unlink current from the cxq or EntryList . @@ -1550,9 +1533,6 @@ void ObjectMonitor::ExitEpilog(JavaThread* current, ObjectWaiter* Wakee) { // Virtual thread case. Trigger->unpark(); } - - // Maintain stats and report events to JVMTI - OM_PERFDATA_OP(Parks, inc()); } // Exits the monitor returning recursion count. _owner should @@ -1998,7 +1978,6 @@ void ObjectMonitor::notify(TRAPS) { } DTRACE_MONITOR_PROBE(notify, this, object(), current); INotify(current); - OM_PERFDATA_OP(Notifications, inc(1)); } @@ -2017,13 +1996,9 @@ void ObjectMonitor::notifyAll(TRAPS) { } DTRACE_MONITOR_PROBE(notifyAll, this, object(), current); - int tally = 0; while (_WaitSet != nullptr) { - tally++; INotify(current); } - - OM_PERFDATA_OP(Notifications, inc(tally)); } void ObjectMonitor::VThreadWait(JavaThread* current, jlong millis) { @@ -2465,14 +2440,6 @@ inline void ObjectMonitor::DequeueSpecificWaiter(ObjectWaiter* node) { } // ----------------------------------------------------------------------------- -// PerfData support -PerfCounter * ObjectMonitor::_sync_ContendedLockAttempts = nullptr; -PerfCounter * ObjectMonitor::_sync_FutileWakeups = nullptr; -PerfCounter * ObjectMonitor::_sync_Parks = nullptr; -PerfCounter * ObjectMonitor::_sync_Notifications = nullptr; -PerfCounter * ObjectMonitor::_sync_Inflations = nullptr; -PerfCounter * ObjectMonitor::_sync_Deflations = nullptr; -PerfLongVariable * ObjectMonitor::_sync_MonExtant = nullptr; // One-shot global initialization for the sync subsystem. // We could also defer initialization and initialize on-demand @@ -2489,29 +2456,6 @@ void ObjectMonitor::Initialize() { Knob_FixedSpin = -1; } - if (UsePerfData) { - EXCEPTION_MARK; -#define NEWPERFCOUNTER(n) \ - { \ - n = PerfDataManager::create_counter(SUN_RT, #n, PerfData::U_Events, \ - CHECK); \ - } -#define NEWPERFVARIABLE(n) \ - { \ - n = PerfDataManager::create_variable(SUN_RT, #n, PerfData::U_Events, \ - CHECK); \ - } - NEWPERFCOUNTER(_sync_Inflations); - NEWPERFCOUNTER(_sync_Deflations); - NEWPERFCOUNTER(_sync_ContendedLockAttempts); - NEWPERFCOUNTER(_sync_FutileWakeups); - NEWPERFCOUNTER(_sync_Parks); - NEWPERFCOUNTER(_sync_Notifications); - NEWPERFVARIABLE(_sync_MonExtant); -#undef NEWPERFCOUNTER -#undef NEWPERFVARIABLE - } - _oop_storage = OopStorageSet::create_weak("ObjectSynchronizer Weak", mtSynchronizer); DEBUG_ONLY(InitDone = true;) diff --git a/src/hotspot/share/runtime/objectMonitor.hpp b/src/hotspot/share/runtime/objectMonitor.hpp index 94c4c242f8271..6f931d67e5d7d 100644 --- a/src/hotspot/share/runtime/objectMonitor.hpp +++ b/src/hotspot/share/runtime/objectMonitor.hpp @@ -31,7 +31,6 @@ #include "oops/oopHandle.hpp" #include "oops/weakHandle.hpp" #include "runtime/javaThread.hpp" -#include "runtime/perfDataTypes.hpp" #include "utilities/checkedCast.hpp" class ObjectMonitor; @@ -202,44 +201,6 @@ class ObjectMonitor : public CHeapObj { static OopHandle& vthread_cxq_head() { return _vthread_cxq_head; } static ParkEvent* vthread_unparker_ParkEvent() { return _vthread_unparker_ParkEvent; } - // Only perform a PerfData operation if the PerfData object has been - // allocated and if the PerfDataManager has not freed the PerfData - // objects which can happen at normal VM shutdown. This operation is - // only safe when thread is not in safepoint-safe code, i.e. PerfDataManager - // could not reach the safepoint and free the counter while we are using it. - // If this is not guaranteed, use OM_PERFDATA_SAFE_OP instead. - #define OM_PERFDATA_OP(f, op_str) \ - do { \ - if (ObjectMonitor::_sync_ ## f != nullptr) { \ - if (PerfDataManager::has_PerfData()) { \ - ObjectMonitor::_sync_ ## f->op_str; \ - } \ - } \ - } while (0) - - // Only perform a PerfData operation if the PerfData object has been - // allocated and if the PerfDataManager has not freed the PerfData - // objects which can happen at normal VM shutdown. Additionally, we - // enter the critical section to resolve the race against PerfDataManager - // entering the safepoint and deleting the counter during shutdown. - #define OM_PERFDATA_SAFE_OP(f, op_str) \ - do { \ - if (ObjectMonitor::_sync_ ## f != nullptr) { \ - GlobalCounter::CriticalSection cs(Thread::current()); \ - if (PerfDataManager::has_PerfData()) { \ - ObjectMonitor::_sync_ ## f->op_str; \ - } \ - } \ - } while (0) - - static PerfCounter * _sync_ContendedLockAttempts; - static PerfCounter * _sync_FutileWakeups; - static PerfCounter * _sync_Parks; - static PerfCounter * _sync_Notifications; - static PerfCounter * _sync_Inflations; - static PerfCounter * _sync_Deflations; - static PerfLongVariable * _sync_MonExtant; - static int Knob_SpinLimit; static ByteSize metadata_offset() { return byte_offset_of(ObjectMonitor, _metadata); } diff --git a/src/hotspot/share/runtime/synchronizer.cpp b/src/hotspot/share/runtime/synchronizer.cpp index 0ee3e24760d18..f7a7fb1eca1e9 100644 --- a/src/hotspot/share/runtime/synchronizer.cpp +++ b/src/hotspot/share/runtime/synchronizer.cpp @@ -48,7 +48,6 @@ #include "runtime/objectMonitor.inline.hpp" #include "runtime/os.inline.hpp" #include "runtime/osThread.hpp" -#include "runtime/perfData.hpp" #include "runtime/safepointMechanism.inline.hpp" #include "runtime/safepointVerifiers.hpp" #include "runtime/sharedRuntime.hpp" @@ -372,12 +371,9 @@ bool ObjectSynchronizer::quick_notify(oopDesc* obj, JavaThread* current, bool al } else { DTRACE_MONITOR_PROBE(notify, mon, obj, current); } - int free_count = 0; do { mon->INotify(current); - ++free_count; } while (mon->first_waiter() != nullptr && all); - OM_PERFDATA_OP(Notifications, inc(free_count)); } return true; } @@ -1583,9 +1579,6 @@ ObjectMonitor* ObjectSynchronizer::inflate_impl(JavaThread* locking_thread, oop // with the ObjectMonitor, it is safe to allow async deflation: _in_use_list.add(m); - // Hopefully the performance counters are allocated on distinct cache lines - // to avoid false sharing on MP systems ... - OM_PERFDATA_OP(Inflations, inc()); if (log_is_enabled(Trace, monitorinflation)) { ResourceMark rm; lsh.print_cr("inflate(has_locker): object=" INTPTR_FORMAT ", mark=" @@ -1625,9 +1618,6 @@ ObjectMonitor* ObjectSynchronizer::inflate_impl(JavaThread* locking_thread, oop // with the ObjectMonitor, it is safe to allow async deflation: _in_use_list.add(m); - // Hopefully the performance counters are allocated on distinct - // cache lines to avoid false sharing on MP systems ... - OM_PERFDATA_OP(Inflations, inc()); if (log_is_enabled(Trace, monitorinflation)) { ResourceMark rm; lsh.print_cr("inflate(unlocked): object=" INTPTR_FORMAT ", mark=" @@ -1855,9 +1845,6 @@ size_t ObjectSynchronizer::deflate_idle_monitors() { log.end(deflated_count, unlinked_count); - OM_PERFDATA_OP(MonExtant, set_value(_in_use_list.count())); - OM_PERFDATA_OP(Deflations, inc(deflated_count)); - GVars.stw_random = os::random(); if (deflated_count != 0) {