]> Cypherpunks repositories - gostls13.git/commitdiff
runtime: fix GODEBUG=schedtrace=X delay handling.
authorRahul Chaudhry <rahulchaudhry@chromium.org>
Thu, 10 Dec 2015 23:06:42 +0000 (15:06 -0800)
committerIan Lance Taylor <iant@golang.org>
Fri, 11 Dec 2015 03:59:20 +0000 (03:59 +0000)
debug.schedtrace is an int32. Convert it to int64 before
multiplying with constant 1000000. Otherwise, schedtrace
values more than 2147 result in int32 overflow causing
incorrect delays between traces.

Change-Id: I064e8d7b432c1e892a705ee1f31a2e8cdd2c3ea3
Reviewed-on: https://go-review.googlesource.com/17712
Reviewed-by: Austin Clements <austin@google.com>
Run-TryBot: Ian Lance Taylor <iant@golang.org>

src/runtime/proc.go

index f641d38a943e8423864b58b9731d8779125f0ff3..9ef7bfb9541c8d4c400411eeaae3156696c5268f 100644 (file)
@@ -3413,7 +3413,7 @@ func sysmon() {
                        lastscavenge = now
                        nscavenge++
                }
-               if debug.schedtrace > 0 && lasttrace+int64(debug.schedtrace*1000000) <= now {
+               if debug.schedtrace > 0 && lasttrace+int64(debug.schedtrace)*1000000 <= now {
                        lasttrace = now
                        schedtrace(debug.scheddetail > 0)
                }