aboutsummaryrefslogtreecommitdiff
path: root/src/runtime/runtime2.go
diff options
context:
space:
mode:
authorIan Lance Taylor <iant@golang.org>2020-01-09 23:03:25 -0800
committerIan Lance Taylor <iant@golang.org>2020-01-10 23:03:06 +0000
commit641e61db57f176e33828ed5354810fa3f13ac76d (patch)
tree5a2de90fbee3bad02ea5b6649afd2c0cddd4497d /src/runtime/runtime2.go
parent1d4d7825a70168492e440af59556bfd6734fa883 (diff)
downloadgo-641e61db57f176e33828ed5354810fa3f13ac76d.tar.gz
go-641e61db57f176e33828ed5354810fa3f13ac76d.zip
runtime: don't let P's timer heap get clogged with deleted timers
Whenever more than 1/4 of the timers on a P's heap are deleted, remove them from the heap. Change-Id: Iff63ed3d04e6f33ffc5c834f77f645c52c007e52 Reviewed-on: https://go-review.googlesource.com/c/go/+/214299 Run-TryBot: Ian Lance Taylor <iant@golang.org> TryBot-Result: Gobot Gobot <gobot@golang.org> Reviewed-by: Michael Knyszek <mknyszek@google.com>
Diffstat (limited to 'src/runtime/runtime2.go')
-rw-r--r--src/runtime/runtime2.go4
1 files changed, 4 insertions, 0 deletions
diff --git a/src/runtime/runtime2.go b/src/runtime/runtime2.go
index 3f9e51c528..10d8d8c043 100644
--- a/src/runtime/runtime2.go
+++ b/src/runtime/runtime2.go
@@ -650,6 +650,10 @@ type p struct {
// such as timerModifying.
adjustTimers uint32
+ // Number of timerDeleted times in P's heap.
+ // Modified using atomic instructions.
+ deletedTimers uint32
+
// Race context used while executing timer functions.
timerRaceCtx uintptr