Investigating Split Locks on x86-64
2 days ago
- #multithreading
- #split-locks
- #cpu-performance
- Split locks are atomic operations crossing cache lines, causing bus locks that degrade performance by disrupting other cores.
- Modern CPUs can trap split locks; Linux uses this to add delays, mitigating noisy neighbor effects but impacting performance.
- Testing on various CPUs shows split lock latency varies widely, from minor impact on older AMD Piledriver to severe on AMD Zen 2/Zen 5 and Intel Arrow Lake.
- Split locks primarily affect cache misses beyond L1/L2, with performance penalties in memory latency and bandwidth, depending on architecture.
- Linux's default split lock mitigation introduces millisecond delays, which may be overkill for consumer systems and harm user experience.
- Programmers should avoid split locks due to poor performance and impact on other applications; hardware optimization is needed.
- The term "bus lock" is outdated; its implementation varies, affecting system behavior differently across CPU designs.