This is an archive of the discontinued LLVM Phabricator instance.

sanitizer_common: modernize SpinMutex
ClosedPublic

Authored by dvyukov on Jul 20 2021, 1:53 AM.

Details

Summary

Some minor improvements:

  1. Make StaticSpinMutex non-copyable.
  2. Add LIKELY to Lock.
  3. Move LockSlow into the .cpp file (now that we have it).
  4. The only non-trivial change: use proc_yield(1) instread of proc_yield(10) with the proportional increase in the number of spin iterations. Latency of the PAUSE instruction has raised from ~1 cycle to ~100 cycles in the recent Intel CPUs. So proc_yield(10) is too aggressive backoff.

Diff Detail

Event Timeline

dvyukov created this revision.Jul 20 2021, 1:53 AM
dvyukov requested review of this revision.Jul 20 2021, 1:53 AM
Herald added a project: Restricted Project. · View Herald TranscriptJul 20 2021, 1:53 AM
Herald added a subscriber: Restricted Project. · View Herald Transcript
vitalybuka accepted this revision.Jul 20 2021, 11:13 AM
This revision is now accepted and ready to land.Jul 20 2021, 11:13 AM
This revision was automatically updated to reflect the committed changes.

This broke some gcc bots, I've created https://reviews.llvm.org/D106424 to fix that.