[PATCH] D64358: [scudo][standalone] Merge Spin & Blocking mutex into a Hybrid one

Kostya Kortchinsky via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon Jul 8 11:52:49 PDT 2019


cryptoad created this revision.
cryptoad added reviewers: morehouse, hctim, eugenis, dvyukov, vitalybuka.
Herald added subscribers: Sanitizers, jfb, delcypher, srhines.
Herald added projects: LLVM, Sanitizers.

We ran into a problem on Fuchsia where yielding threads would never
be deboosted, ultimately resulting in several threads spinning on the
same TSD, and no possibility for another thread to be scheduled,
dead-locking the process.

While this was fixed in Zircon, this lead to discussions about if
spinning without a break condition was a good decision, and settled on
a new hybrid model that would spin for a while then block.

Currently we are using a number of iterations for spinning that is
mostly arbitrary (based on sanitizer_common values), but this can
be tuned in the future.

Since we are touching `common.h`, we also use this change as a vehicle
for an Android optimization (the page size is fixed in Bionic, so use
a fixed value too).


Repository:
  rCRT Compiler Runtime

https://reviews.llvm.org/D64358

Files:
  lib/scudo/standalone/atomic_helpers.h
  lib/scudo/standalone/bytemap.h
  lib/scudo/standalone/common.h
  lib/scudo/standalone/fuchsia.cc
  lib/scudo/standalone/linux.cc
  lib/scudo/standalone/mutex.h
  lib/scudo/standalone/primary32.h
  lib/scudo/standalone/primary64.h
  lib/scudo/standalone/quarantine.h
  lib/scudo/standalone/secondary.cc
  lib/scudo/standalone/secondary.h
  lib/scudo/standalone/stats.h
  lib/scudo/standalone/tests/mutex_test.cc
  lib/scudo/standalone/tsd.h
  lib/scudo/standalone/tsd_exclusive.h
  lib/scudo/standalone/tsd_shared.h

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D64358.208471.patch
Type: text/x-patch
Size: 22369 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20190708/d13ff0ac/attachment.bin>


More information about the llvm-commits mailing list