From fa24d58279cf9a3e5a5ac894194808f4c1ad01f3 Mon Sep 17 00:00:00 2001 From: Dmitry Vyukov Date: Tue, 16 Nov 2021 09:14:09 +0100 Subject: [PATCH] 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 --- compiler-rt/lib/tsan/rtl/tsan_trace.h | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/compiler-rt/lib/tsan/rtl/tsan_trace.h b/compiler-rt/lib/tsan/rtl/tsan_trace.h index a771ad9..c13fb12 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 -- 2.7.4