< prev index next >

src/hotspot/share/runtime/objectMonitor.cpp

Print this page
rev 51780 : imported patch syncknobs-00-base
rev 51781 : imported patch syncknobs-01-Knob_ReportSettings
rev 51782 : imported patch syncknobs-02-Knob_SpinBackOff
rev 51783 : imported patch syncknobs-03-BackOffMask
rev 51784 : imported patch syncknobs-04-Knob_ExitRelease
rev 51785 : imported patch syncknobs-05-Knob_InlineNotify
rev 51786 : imported patch syncknobs-06-Knob_Verbose
rev 51787 : imported patch syncknobs-07-Knob_VerifyInUse
rev 51788 : imported patch syncknobs-08-Knob_VerifyMatch
rev 51789 : imported patch syncknobs-09-Knob_SpinBase
rev 51790 : imported patch syncknobs-10-Knob_CASPenalty
rev 51791 : imported patch syncknobs-11-Knob_OXPenalty
rev 51792 : imported patch syncknobs-12-Knob_SpinSetSucc

*** 101,111 **** // The knob* variables are effectively final. Once set they should // never be modified hence. Consider using __read_mostly with GCC. int ObjectMonitor::Knob_SpinLimit = 5000; // derived by an external tool - - static int Knob_SpinSetSucc = 1; // spinners set the _succ field static int Knob_SpinEarly = 1; static int Knob_SuccEnabled = 1; // futile wake throttling static int Knob_SuccRestrict = 0; // Limit successors + spinners to at-most-one static int Knob_MaxSpinners = -1; // Should be a function of # CPUs static int Knob_Bonus = 100; // spin success bonus --- 101,110 ----
*** 1861,1872 **** // We're good to spin ... spin ingress. // CONSIDER: use Prefetch::write() to avoid RTS->RTO upgrades // when preparing to LD...CAS _owner, etc and the CAS is likely // to succeed. ! int sss = Knob_SpinSetSucc; ! if (sss && _succ == NULL) _succ = Self; Thread * prv = NULL; // There are three ways to exit the following loop: // 1. A successful spin where this thread has acquired the lock. // 2. Spin failure with prejudice --- 1860,1872 ---- // We're good to spin ... spin ingress. // CONSIDER: use Prefetch::write() to avoid RTS->RTO upgrades // when preparing to LD...CAS _owner, etc and the CAS is likely // to succeed. ! if (_succ == NULL) { ! _succ = Self; ! } Thread * prv = NULL; // There are three ways to exit the following loop: // 1. A successful spin where this thread has acquired the lock. // 2. Spin failure with prejudice
*** 1906,1916 **** if (ox == NULL) { ox = (Thread*)Atomic::cmpxchg(Self, &_owner, (void*)NULL); if (ox == NULL) { // The CAS succeeded -- this thread acquired ownership // Take care of some bookkeeping to exit spin state. ! if (sss && _succ == Self) { _succ = NULL; } if (MaxSpin > 0) Adjust(&_Spinner, -1); // Increase _SpinDuration : --- 1906,1916 ---- if (ox == NULL) { ox = (Thread*)Atomic::cmpxchg(Self, &_owner, (void*)NULL); if (ox == NULL) { // The CAS succeeded -- this thread acquired ownership // Take care of some bookkeeping to exit spin state. ! if (_succ == Self) { _succ = NULL; } if (MaxSpin > 0) Adjust(&_Spinner, -1); // Increase _SpinDuration :
*** 1948,1958 **** // Spinning while the owner is OFFPROC is idiocy. // Consider: ctr -= RunnablePenalty ; if (Knob_OState && NotRunnable (Self, ox)) { goto Abort; } ! if (sss && _succ == NULL) _succ = Self; } // Spin failed with prejudice -- reduce _SpinDuration. // TODO: Use an AIMD-like policy to adjust _SpinDuration. // AIMD is globally stable. --- 1948,1960 ---- // Spinning while the owner is OFFPROC is idiocy. // Consider: ctr -= RunnablePenalty ; if (Knob_OState && NotRunnable (Self, ox)) { goto Abort; } ! if (_succ == NULL) { ! _succ = Self; ! } } // Spin failed with prejudice -- reduce _SpinDuration. // TODO: Use an AIMD-like policy to adjust _SpinDuration. // AIMD is globally stable.
*** 1967,1977 **** } } Abort: if (MaxSpin >= 0) Adjust(&_Spinner, -1); ! if (sss && _succ == Self) { _succ = NULL; // Invariant: after setting succ=null a contending thread // must recheck-retry _owner before parking. This usually happens // in the normal usage of TrySpin(), but it's safest // to make TrySpin() as foolproof as possible. --- 1969,1979 ---- } } Abort: if (MaxSpin >= 0) Adjust(&_Spinner, -1); ! if (_succ == Self) { _succ = NULL; // Invariant: after setting succ=null a contending thread // must recheck-retry _owner before parking. This usually happens // in the normal usage of TrySpin(), but it's safest // to make TrySpin() as foolproof as possible.
< prev index next >