diff options
Diffstat (limited to 'libsanitizer/tsan/tsan_sync.h')
-rw-r--r-- | libsanitizer/tsan/tsan_sync.h | 13 |
1 files changed, 6 insertions, 7 deletions
diff --git a/libsanitizer/tsan/tsan_sync.h b/libsanitizer/tsan/tsan_sync.h index 2867a8ac79ef..3838df91d757 100644 --- a/libsanitizer/tsan/tsan_sync.h +++ b/libsanitizer/tsan/tsan_sync.h @@ -13,14 +13,13 @@ #include "sanitizer_common/sanitizer_atomic.h" #include "sanitizer_common/sanitizer_common.h" +#include "sanitizer_common/sanitizer_deadlock_detector_interface.h" #include "tsan_clock.h" #include "tsan_defs.h" #include "tsan_mutex.h" namespace __tsan { -class SlabCache; - class StackTrace { public: StackTrace(); @@ -55,8 +54,6 @@ struct SyncVar { Mutex mtx; uptr addr; const u64 uid; // Globally unique id. - SyncClock clock; - SyncClock read_clock; // Used for rw mutexes only. u32 creation_stack_id; int owner_tid; // Set only by exclusive owners. u64 last_lock; @@ -66,8 +63,12 @@ struct SyncVar { bool is_broken; bool is_linker_init; SyncVar *next; // In SyncTab hashtable. + DDMutex dd; + SyncClock read_clock; // Used for rw mutexes only. + // The clock is placed last, so that it is situated on a different cache line + // with the mtx. This reduces contention for hot sync objects. + SyncClock clock; - uptr GetMemoryConsumption(); u64 GetId() const { // 47 lsb is addr, then 14 bits is low part of uid, then 3 zero bits. return GetLsb((u64)addr | (uid << 47), 61); @@ -96,8 +97,6 @@ class SyncTab { SyncVar* Create(ThreadState *thr, uptr pc, uptr addr); - uptr GetMemoryConsumption(uptr *nsync); - private: struct Part { Mutex mtx; |