~smspillaz/folly/folly-git-master

Viewing all changes in revision 7184.

  • Committer: Facebook Github Bot
  • Author(s): Aaryaman Sagar
  • Date: 2019-05-24 15:14:55 UTC
  • Revision ID: git-v1:85d3f301bf09fc0e3d932fce7886552d3feba555
Pessimize DistributedMutex::try_lock, update comments and benchmarks

Summary:
A few changes:

- Pessimize DistributedMutex::try_lock() to do a load on the mutex before
  attempting a lock bts.  This allows us to be effectively parallel in the case
  where acquiring the mutex is not a hard requirement for the application.
  Whenever perf-sensitive try_lock()s come up, they tend to fit this model -
  where acquiring the mutex allows one thread to make progress, but missing the
  lock doesn't lead to incorrectness.  It mostly does not hurt performance, so
  seems like a good thing to have for all cases.
- More unit tests that test progress in the presence of many locks
- Also update comments to be slightly more clear, in particular add a small
  comparison with std::atomic in the first few sentences, and
- Rerun benchmarks on both broadwell and skylake

Reviewed By: djwatson

Differential Revision: D15378164

fbshipit-source-id: 124db4052dadae102a5c04ad9b9f3bcbefe74458

expand all expand all

Show diffs side-by-side

added added

removed removed

Lines of Context: