]> Cypherpunks repositories - gostls13.git/commit
runtime: avoid overflow in mutex delay calculation
authorRhys Hiltner <rhys.hiltner@gmail.com>
Thu, 8 May 2025 17:59:18 +0000 (10:59 -0700)
committerGopher Robot <gobot@golang.org>
Thu, 8 May 2025 19:07:41 +0000 (12:07 -0700)
commitac645eaa0efc982eb238188a5f14835d2c1f8d18
treef6d274a52db259a6af91a7563144354d0278be3d
parent60d3bcdec38eafbffe3086d8aea190ff8bcdece7
runtime: avoid overflow in mutex delay calculation

If cputicks is in the top quarter of the int64's range, adding two
values together will overflow and confuse the subsequent calculations,
leading to zero-duration contention events in the profile.

This fixes the TestRuntimeLockMetricsAndProfile failures on the
linux-s390x builder.

Change-Id: Icb814c39a8702379dfd71c06a53b2618e3589e07
Reviewed-on: https://go-review.googlesource.com/c/go/+/671115
Reviewed-by: Michael Knyszek <mknyszek@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Run-TryBot: Rhys Hiltner <rhys.hiltner@gmail.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Auto-Submit: Michael Knyszek <mknyszek@google.com>
Reviewed-by: Cherry Mui <cherryyz@google.com>
src/runtime/lock_spinbit.go