Skip to content
Commit 8844d9b2 authored by H.J. Lu's avatar H.J. Lu Committed by Sunil K Pandey
Browse files

Add LLL_MUTEX_READ_LOCK [BZ #28537]

CAS instruction is expensive.  From the x86 CPU's point of view, getting
a cache line for writing is more expensive than reading.  See Appendix
A.2 Spinlock in:

https://www.intel.com/content/dam/www/public/us/en/documents/white-papers/xeon-lock-scaling-analysis-paper.pdf



The full compare and swap will grab the cache line exclusive and cause
excessive cache line bouncing.

Add LLL_MUTEX_READ_LOCK to do an atomic load and skip CAS in spinlock
loop if compare may fail to reduce cache line bouncing on contended locks.

Reviewed-by: default avatarSzabolcs Nagy <szabolcs.nagy@arm.com>
(cherry picked from commit d672a98a)
parent 0ec27673
Loading
Loading
Loading
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment