aboutsummaryrefslogtreecommitdiff
path: root/src/runtime/mgcsweep.go
diff options
context:
space:
mode:
Diffstat (limited to 'src/runtime/mgcsweep.go')
-rw-r--r--src/runtime/mgcsweep.go14
1 files changed, 4 insertions, 10 deletions
diff --git a/src/runtime/mgcsweep.go b/src/runtime/mgcsweep.go
index 92ddc51e1f..ab18d5ff88 100644
--- a/src/runtime/mgcsweep.go
+++ b/src/runtime/mgcsweep.go
@@ -11,8 +11,8 @@ import "unsafe"
var sweep sweepdata
// State of background sweep.
-// Protected by gclock.
type sweepdata struct {
+ lock mutex
g *g
parked bool
started bool
@@ -23,8 +23,6 @@ type sweepdata struct {
npausesweep uint32
}
-var gclock mutex
-
//go:nowritebarrier
func finishsweep_m() {
// The world is stopped so we should be able to complete the sweeps
@@ -51,16 +49,16 @@ func bgsweep() {
sweep.nbgsweep++
Gosched()
}
- lock(&gclock)
+ lock(&sweep.lock)
if !gosweepdone() {
// This can happen if a GC runs between
// gosweepone returning ^0 above
// and the lock being acquired.
- unlock(&gclock)
+ unlock(&sweep.lock)
continue
}
sweep.parked = true
- goparkunlock(&gclock, "GC sweep wait", traceEvGoBlock)
+ goparkunlock(&sweep.lock, "GC sweep wait", traceEvGoBlock)
}
}
@@ -145,10 +143,6 @@ func mSpan_EnsureSwept(s *mspan) {
// caller takes care of it.
//TODO go:nowritebarrier
func mSpan_Sweep(s *mspan, preserve bool) bool {
- if checkmarkphase {
- throw("MSpan_Sweep: checkmark only runs in STW and after the sweep")
- }
-
// It's critical that we enter this function with preemption disabled,
// GC must not start while we are in the middle of this function.
_g_ := getg()