@@ -711,22 +711,6 @@ func (c *gcControllerState) findRunnableGCWorker(_p_ *p) *g {
711
711
// This P has picked the token for the fractional worker.
712
712
// Is the GC currently under or at the utilization goal?
713
713
// If so, do more work.
714
- //
715
- // We used to check whether doing one time slice of work
716
- // would remain under the utilization goal, but that has the
717
- // effect of delaying work until the mutator has run for
718
- // enough time slices to pay for the work. During those time
719
- // slices, write barriers are enabled, so the mutator is running slower.
720
- // Now instead we do the work whenever we're under or at the
721
- // utilization work and pay for it by letting the mutator run later.
722
- // This doesn't change the overall utilization averages, but it
723
- // front loads the GC work so that the GC finishes earlier and
724
- // write barriers can be turned off sooner, effectively giving
725
- // the mutator a faster machine.
726
- //
727
- // The old, slower behavior can be restored by setting
728
- // gcForcePreemptNS = forcePreemptNS.
729
- const gcForcePreemptNS = 0
730
714
731
715
// TODO(austin): We could fast path this and basically
732
716
// eliminate contention on c.fractionalMarkWorkersNeeded by
@@ -739,10 +723,8 @@ func (c *gcControllerState) findRunnableGCWorker(_p_ *p) *g {
739
723
// TODO(austin): Shorter preemption interval for mark
740
724
// worker to improve fairness and give this
741
725
// finer-grained control over schedule?
742
- now := nanotime () - gcController .markStartTime
743
- then := now + gcForcePreemptNS
744
- timeUsed := c .fractionalMarkTime + gcForcePreemptNS
745
- if then > 0 && float64 (timeUsed )/ float64 (then ) > c .fractionalUtilizationGoal {
726
+ delta := nanotime () - c .markStartTime
727
+ if delta > 0 && float64 (c .fractionalMarkTime )/ float64 (delta ) > c .fractionalUtilizationGoal {
746
728
// Nope, we'd overshoot the utilization goal
747
729
atomic .Xaddint64 (& c .fractionalMarkWorkersNeeded , + 1 )
748
730
return nil
0 commit comments