mirror of
https://github.com/golang/go.git
synced 2025-12-08 06:10:04 +00:00
runtime: fix idle time double-counting bug
This change fixes a bug in the accounting of sched.idleTime. In just the case where the GC CPU limiter needs up-to-date data, sched.idleTime is incremented in both the P-idle-time and idle-mark-work paths, but it should only be incremented in the former case. Fixes #74627. Change-Id: If41b03da102d47d25bec48ff750a9da27019b71d Reviewed-on: https://go-review.googlesource.com/c/go/+/687998 Reviewed-by: Cherry Mui <cherryyz@google.com> LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com> Reviewed-by: Michael Pratt <mpratt@google.com>
This commit is contained in:
parent
f506ad2644
commit
385000b004
1 changed files with 8 additions and 12 deletions
|
|
@ -209,14 +209,12 @@ func (l *gcCPULimiterState) updateLocked(now int64) {
|
||||||
for _, pp := range allp {
|
for _, pp := range allp {
|
||||||
typ, duration := pp.limiterEvent.consume(now)
|
typ, duration := pp.limiterEvent.consume(now)
|
||||||
switch typ {
|
switch typ {
|
||||||
case limiterEventIdleMarkWork:
|
|
||||||
fallthrough
|
|
||||||
case limiterEventIdle:
|
case limiterEventIdle:
|
||||||
idleTime += duration
|
|
||||||
sched.idleTime.Add(duration)
|
sched.idleTime.Add(duration)
|
||||||
case limiterEventMarkAssist:
|
idleTime += duration
|
||||||
fallthrough
|
case limiterEventIdleMarkWork:
|
||||||
case limiterEventScavengeAssist:
|
idleTime += duration
|
||||||
|
case limiterEventMarkAssist, limiterEventScavengeAssist:
|
||||||
assistTime += duration
|
assistTime += duration
|
||||||
case limiterEventNone:
|
case limiterEventNone:
|
||||||
break
|
break
|
||||||
|
|
@ -470,14 +468,12 @@ func (e *limiterEvent) stop(typ limiterEventType, now int64) {
|
||||||
}
|
}
|
||||||
// Account for the event.
|
// Account for the event.
|
||||||
switch typ {
|
switch typ {
|
||||||
|
case limiterEventIdle:
|
||||||
|
sched.idleTime.Add(duration)
|
||||||
|
gcCPULimiter.addIdleTime(duration)
|
||||||
case limiterEventIdleMarkWork:
|
case limiterEventIdleMarkWork:
|
||||||
gcCPULimiter.addIdleTime(duration)
|
gcCPULimiter.addIdleTime(duration)
|
||||||
case limiterEventIdle:
|
case limiterEventMarkAssist, limiterEventScavengeAssist:
|
||||||
gcCPULimiter.addIdleTime(duration)
|
|
||||||
sched.idleTime.Add(duration)
|
|
||||||
case limiterEventMarkAssist:
|
|
||||||
fallthrough
|
|
||||||
case limiterEventScavengeAssist:
|
|
||||||
gcCPULimiter.addAssistTime(duration)
|
gcCPULimiter.addAssistTime(duration)
|
||||||
default:
|
default:
|
||||||
throw("limiterEvent.stop: invalid limiter event type found")
|
throw("limiterEvent.stop: invalid limiter event type found")
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue