[compiler-rt] fa24d58 - tsan: use smaller trace parts for Go

Dmitry Vyukov via llvm-commits llvm-commits at lists.llvm.org
Tue Nov 16 06:59:37 PST 2021


Author: Dmitry Vyukov
Date: 2021-11-16T15:59:33+01:00
New Revision: fa24d58279cf9a3e5a5ac894194808f4c1ad01f3

URL: https://github.com/llvm/llvm-project/commit/fa24d58279cf9a3e5a5ac894194808f4c1ad01f3
DIFF: https://github.com/llvm/llvm-project/commit/fa24d58279cf9a3e5a5ac894194808f4c1ad01f3.diff

LOG: tsan: use smaller trace parts for Go

In the old runtime we used to use different number of trace parts
for C++ and Go to reduce trace memory consumption for Go.
But now it's easier and better to use smaller parts because
we already use minimal possible number of parts for C++ (3).

Reviewed By: melver

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

Added: 
    

Modified: 
    compiler-rt/lib/tsan/rtl/tsan_trace.h

Removed: 
    


################################################################################
diff  --git a/compiler-rt/lib/tsan/rtl/tsan_trace.h b/compiler-rt/lib/tsan/rtl/tsan_trace.h
index a771ad9f52fd..c13fb12e1b90 100644
--- a/compiler-rt/lib/tsan/rtl/tsan_trace.h
+++ b/compiler-rt/lib/tsan/rtl/tsan_trace.h
@@ -191,7 +191,8 @@ struct TraceHeader {
 };
 
 struct TracePart : TraceHeader {
-  static constexpr uptr kByteSize = 256 << 10;
+  // There are a lot of goroutines in Go, so we use smaller parts.
+  static constexpr uptr kByteSize = (SANITIZER_GO ? 128 : 256) << 10;
   static constexpr uptr kSize =
       (kByteSize - sizeof(TraceHeader)) / sizeof(Event);
   // TraceAcquire does a fast event pointer overflow check by comparing


        


More information about the llvm-commits mailing list