mirror of https://github.com/golang/go.git
runtime: rename gosweepdone to isSweepDone and document better
gosweepdone is another anachronism from the time when the sweeper was implemented in C. Rename it to "isSweepDone" for the modern era. Change-Id: I8472aa6f52478459c3f2edc8a4b2761e73c4c2dd Reviewed-on: https://go-review.googlesource.com/c/138658 Run-TryBot: Austin Clements <austin@google.com> TryBot-Result: Gobot Gobot <gobot@golang.org> Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
This commit is contained in:
parent
f3bb4cbfd5
commit
007e8a2fbd
|
|
@ -789,7 +789,7 @@ func gcSetTriggerRatio(triggerRatio float64) {
|
|||
trigger = uint64(float64(memstats.heap_marked) * (1 + triggerRatio))
|
||||
// Don't trigger below the minimum heap size.
|
||||
minTrigger := heapminimum
|
||||
if !gosweepdone() {
|
||||
if !isSweepDone() {
|
||||
// Concurrent sweep happens in the heap growth
|
||||
// from heap_live to gc_trigger, so ensure
|
||||
// that concurrent sweep has some heap growth
|
||||
|
|
@ -834,7 +834,7 @@ func gcSetTriggerRatio(triggerRatio float64) {
|
|||
}
|
||||
|
||||
// Update sweep pacing.
|
||||
if gosweepdone() {
|
||||
if isSweepDone() {
|
||||
mheap_.sweepPagesPerByte = 0
|
||||
} else {
|
||||
// Concurrent sweep needs to sweep all of the in-use
|
||||
|
|
|
|||
|
|
@ -60,7 +60,7 @@ func bgsweep(c chan int) {
|
|||
Gosched()
|
||||
}
|
||||
lock(&sweep.lock)
|
||||
if !gosweepdone() {
|
||||
if !isSweepDone() {
|
||||
// This can happen if a GC runs between
|
||||
// gosweepone returning ^0 above
|
||||
// and the lock being acquired.
|
||||
|
|
@ -134,8 +134,13 @@ func sweepone() uintptr {
|
|||
return npages
|
||||
}
|
||||
|
||||
//go:nowritebarrier
|
||||
func gosweepdone() bool {
|
||||
// isSweepDone reports whether all spans are swept or currently being swept.
|
||||
//
|
||||
// Note that this condition may transition from false to true at any
|
||||
// time as the sweeper runs. It may transition from true to false if a
|
||||
// GC runs; to prevent that the caller must be non-preemptible or must
|
||||
// somehow block GC progress.
|
||||
func isSweepDone() bool {
|
||||
return mheap_.sweepdone != 0
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue