[all-commits] [llvm/llvm-project] 927efd: sanitizer_common: modernize SpinMutex

Dmitry Vyukov via All-commits all-commits at lists.llvm.org
Tue Jul 20 23:14:26 PDT 2021


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: 927efd0b5d27985d7ac3e16f437b101f17df63de
      https://github.com/llvm/llvm-project/commit/927efd0b5d27985d7ac3e16f437b101f17df63de
  Author: Dmitry Vyukov <dvyukov at google.com>
  Date:   2021-07-21 (Wed, 21 Jul 2021)

  Changed paths:
    M compiler-rt/lib/sanitizer_common/sanitizer_mutex.cpp
    M compiler-rt/lib/sanitizer_common/sanitizer_mutex.h

  Log Message:
  -----------
  sanitizer_common: modernize SpinMutex

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.

Reviewed By: vitalybuka

Differential Revision: https://reviews.llvm.org/D106350




More information about the All-commits mailing list