[PATCH] D26232: [XRay][compiler-rt] XRay Buffer Queue

Serge Rogatch via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Fri Nov 25 10:14:00 PST 2016


rSerge added a comment.

I forgot one argument in favor of a spinlock: to alleviate the problem of sudden long-running operations (such as thread preemption), after spinning for N times (where N is such that 95% of times the guarded operation takes less times), the spinlock acquisition code should issue `std::this_thread::yield()`, so not to consume CPU if other threads have real work to do. Even though the CPU load with such approach is higher than with syscall-based mutexes, that load is effectively in background priority.
But see yourself, perhaps it's not a good idea to optimize prematurely.


Repository:
  rL LLVM

https://reviews.llvm.org/D26232





More information about the llvm-commits mailing list