From: Xiangdong Ji Date: Fri, 25 Jun 2021 13:51:22 +0000 (+0800) Subject: runtime: fix uncondition calls to traceGCSTWDone X-Git-Tag: go1.20rc1~369 X-Git-Url: http://www.git.cypherpunks.su/?a=commitdiff_plain;h=8befe0e4083a2a61741f03fb4e4cc2814fe27c35;p=gostls13.git 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 --- 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