This puts each stack in the pool below into its own cache line. This is
an absolutely critical optimization that tends to have the most impact
in high contention workloads. Without forcing each mutex protected
into its own cache line, high contention exacerbates the performance
problem by causing βfalse sharing.β By putting each mutex in its own
cache-line, we avoid the false sharing problem and the affects of
contention are greatly reduced.
This sentinel is used to indicate that a guard has already been dropped
and should not be re-dropped. We use this because our drop code can be
called outside of Drop and thus there could be a bug in the internal
implementation that results in trying to put the same guard back into
the same pool multiple times, and that could result in UB if we
didnβt mark the guard as already having been put back in the pool.
A thread ID indicating that the special owner value is in use and not
available. This state is useful for avoiding a case where the owner
of a pool calls get before putting the result of a previous get
call back into the pool.