From: Davidlohr Bueso<davidlohr@xxxxxx>
+
+(ii) midpath: aka optimistic spinning, tries to spin for acquisition
+ when there are no pending waiters and the lock owner is currently
+ running on a different CPU. The rationale is that if the lock owner
+ is running, it is likely to release the lock soon. The mutex spinners
+ are queued up using MCS lock so that only one spinner can compete for
+ the mutex.
+
+ The MCS lock (proposed by Mellor-Crummey and Scott) is a simple spinlock
+ with the desirable properties of being fair and with each cpu trying
+ to acquire the lock spinning on a local variable. It avoids expensive
+ cacheline bouncing that common test-and-set spinlock implementations
+ incur. An MCS-like lock is specially tailored for optimistic spinning
+ for sleeping lock implementation. An important feature of the customized
+ MCS lock is that it has the extra property that spinners are able to exit
+ the MCS spinlock queue when they need to reschedule. This further helps
+ avoid situations where MCS spinners that need to reschedule would continue
+ waiting to spin on mutex owner, only to go directly to slowpath upon
+ obtaining the MCS lock.
+
+
+(iii) slowpath: last resort, if the lock is still unable to be acquired,
+ the task is added to the wait-queue and sleeps until it can be taken.