Commit ff71ed86 authored by Austin Clements's avatar Austin Clements

runtime: merge {bgMark,assist}StartTime

We used to start background mark workers and assists at different
times, so we needed to keep track of these separately. They're now set
to exactly the same time, so clean things up by merging them in to one
value, markStartTime.

Change-Id: I17c9843c3ed2d6f07b4c8cd0b2c438fc6de23b53
Reviewed-on: https://go-review.googlesource.com/20143
Run-TryBot: Austin Clements <austin@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: default avatarRick Hudson <rlh@golang.org>
parent da1802f1
...@@ -340,13 +340,9 @@ type gcControllerState struct { ...@@ -340,13 +340,9 @@ type gcControllerState struct {
// the cycle. // the cycle.
idleMarkTime int64 idleMarkTime int64
// bgMarkStartTime is the absolute start time in nanoseconds // markStartTime is the absolute start time in nanoseconds
// that the background mark phase started. // that assists and background mark workers started.
bgMarkStartTime int64 markStartTime int64
// assistTime is the absolute start time in nanoseconds that
// mutator assists were enabled.
assistStartTime int64
// heapGoal is the goal memstats.heap_live for when this cycle // heapGoal is the goal memstats.heap_live for when this cycle
// ends. This is computed at the beginning of each cycle. // ends. This is computed at the beginning of each cycle.
...@@ -542,7 +538,7 @@ func (c *gcControllerState) endCycle() { ...@@ -542,7 +538,7 @@ func (c *gcControllerState) endCycle() {
// technically isn't comparable to the trigger ratio. // technically isn't comparable to the trigger ratio.
goalGrowthRatio := float64(gcpercent) / 100 goalGrowthRatio := float64(gcpercent) / 100
actualGrowthRatio := float64(memstats.heap_live)/float64(memstats.heap_marked) - 1 actualGrowthRatio := float64(memstats.heap_live)/float64(memstats.heap_marked) - 1
assistDuration := nanotime() - c.assistStartTime assistDuration := nanotime() - c.markStartTime
// Assume background mark hit its utilization goal. // Assume background mark hit its utilization goal.
utilization := gcGoalUtilization utilization := gcGoalUtilization
...@@ -700,7 +696,7 @@ func (c *gcControllerState) findRunnableGCWorker(_p_ *p) *g { ...@@ -700,7 +696,7 @@ func (c *gcControllerState) findRunnableGCWorker(_p_ *p) *g {
// TODO(austin): Shorter preemption interval for mark // TODO(austin): Shorter preemption interval for mark
// worker to improve fairness and give this // worker to improve fairness and give this
// finer-grained control over schedule? // finer-grained control over schedule?
now := nanotime() - gcController.bgMarkStartTime now := nanotime() - gcController.markStartTime
then := now + gcForcePreemptNS then := now + gcForcePreemptNS
timeUsed := c.fractionalMarkTime + gcForcePreemptNS timeUsed := c.fractionalMarkTime + gcForcePreemptNS
if then > 0 && float64(timeUsed)/float64(then) > c.fractionalUtilizationGoal { if then > 0 && float64(timeUsed)/float64(then) > c.fractionalUtilizationGoal {
...@@ -1002,8 +998,7 @@ func gcStart(mode gcMode, forceTrigger bool) { ...@@ -1002,8 +998,7 @@ func gcStart(mode gcMode, forceTrigger bool) {
// Assists and workers can start the moment we start // Assists and workers can start the moment we start
// the world. // the world.
gcController.assistStartTime = now gcController.markStartTime = now
gcController.bgMarkStartTime = now
// Concurrent mark. // Concurrent mark.
systemstack(startTheWorldWithSema) systemstack(startTheWorldWithSema)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment