kernel - Carefully refactor contended tokens and spinlocks
* Carefully put the exponential backoff back in for spinlocks, and
implement for tokens. Only applicable to exclusive locks, capped
via sysctl (mjg). Tested on dual-socket xeon.
* Exclusive priority for shared locks reduces the shared/exclusive
starvation that can occur when exclusive locks use exponential
backoff.
* Exponential backoff significantly improves performance for
heavily contended exclusive locks by allowing some degree of burst
operation.
* Implement TSC windowing for shared locks (and a little for
exclusive locks too). This prevents heavily contended exclusive
locks from completely starving shared locks by using windowing
to disable the exclusive-priority mechanic for shared locks.
This allows a few contending shared locks to compete on equal
ground with exclusive locks.
Suggested-by: mjg