From 8befe0e4083a2a61741f03fb4e4cc2814fe27c35 Mon Sep 17 00:00:00 2001 From: Xiangdong Ji Date: Fri, 25 Jun 2021 21:51:22 +0800 Subject: [PATCH] runtime: fix uncondition calls to traceGCSTWDone startTheWorldWithSema should call traceGCSTWDone only when the tracing is enabled. Change-Id: Ibc7181834f68af3923e4b2aee01a57492ab6213e Reviewed-on: https://go-review.googlesource.com/c/go/+/330835 Reviewed-by: Ian Lance Taylor Reviewed-by: Michael Pratt Auto-Submit: Ian Lance Taylor Run-TryBot: Ian Lance Taylor TryBot-Result: Gopher Robot --- src/runtime/mgc.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/runtime/mgc.go b/src/runtime/mgc.go index 0cb507346a..69dc5433b1 100644 --- a/src/runtime/mgc.go +++ b/src/runtime/mgc.go @@ -879,7 +879,7 @@ top: if restart { getg().m.preemptoff = "" systemstack(func() { - now := startTheWorldWithSema(true) + now := startTheWorldWithSema(trace.enabled) work.pauseNS += now - work.pauseStart memstats.gcPauseDist.record(now - work.pauseStart) }) @@ -1087,7 +1087,7 @@ func gcMarkTermination() { throw("failed to set sweep barrier") } - systemstack(func() { startTheWorldWithSema(true) }) + systemstack(func() { startTheWorldWithSema(trace.enabled) }) // Flush the heap profile so we can start a new cycle next GC. // This is relatively expensive, so we don't do it with the -- 2.50.0