mirror of
https://github.com/golang/go
synced 2024-09-24 23:10:12 -06:00
runtime: avoid span root marking entirely during mark termination
Currently we enqueue span root mark jobs during both concurrent mark and mark termination, but we make the job a no-op during mark termination. This is silly. Instead of queueing them up just to not do them, don't queue them up in the first place. Change-Id: Ie1d36de884abfb17dd0db6f0449a2b7c997affab Reviewed-on: https://go-review.googlesource.com/20666 Reviewed-by: Rick Hudson <rlh@golang.org> Run-TryBot: Austin Clements <austin@google.com> TryBot-Result: Gobot Gobot <gobot@golang.org>
This commit is contained in:
parent
e8337491aa
commit
efb0c55407
@ -55,8 +55,19 @@ func gcMarkRootPrepare() {
|
||||
}
|
||||
}
|
||||
|
||||
// Compute number of span roots.
|
||||
if !work.markrootDone {
|
||||
// On the first markroot, we need to scan span roots.
|
||||
// In concurrent GC, this happens during concurrent
|
||||
// mark and we depend on addfinalizer to ensure the
|
||||
// above invariants for objects that get finalizers
|
||||
// after concurrent mark. In STW GC, this will happen
|
||||
// during mark termination.
|
||||
work.nSpanRoots = (len(work.spans) + rootBlockSpans - 1) / rootBlockSpans
|
||||
} else {
|
||||
// We've already scanned span roots and kept the scan
|
||||
// up-to-date during concurrent mark.
|
||||
work.nSpanRoots = 0
|
||||
}
|
||||
|
||||
// Snapshot of allglen. During concurrent scan, we just need
|
||||
// to be consistent about how many markroot jobs we create and
|
||||
@ -263,14 +274,8 @@ func markrootSpans(gcw *gcWork, shard int) {
|
||||
// TODO(austin): There are several ideas for making this more
|
||||
// efficient in issue #11485.
|
||||
|
||||
// We process objects with finalizers only during the first
|
||||
// markroot pass. In concurrent GC, this happens during
|
||||
// concurrent mark and we depend on addfinalizer to ensure the
|
||||
// above invariants for objects that get finalizers after
|
||||
// concurrent mark. In STW GC, this will happen during mark
|
||||
// termination.
|
||||
if work.markrootDone {
|
||||
return
|
||||
throw("markrootSpans during second markroot")
|
||||
}
|
||||
|
||||
sg := mheap_.sweepgen
|
||||
|
Loading…
Reference in New Issue
Block a user