aboutsummaryrefslogtreecommitdiff
path: root/src/runtime/mgcwork.go
diff options
context:
space:
mode:
authorAustin Clements <austin@google.com>2015-03-12 12:08:47 -0400
committerAustin Clements <austin@google.com>2015-04-21 15:35:00 +0000
commit571ebae6ef0f9edb09e516b75a757cfeeb51da35 (patch)
tree1689199138b86bc5771566dd737d7a915ab352b7 /src/runtime/mgcwork.go
parentfb9fd2bdd7024e8d92e7c2a1436843cbca6e1ed1 (diff)
downloadgo-571ebae6ef0f9edb09e516b75a757cfeeb51da35.tar.gz
go-571ebae6ef0f9edb09e516b75a757cfeeb51da35.zip
runtime: track scan work performed during concurrent mark
This tracks the amount of scan work in terms of scanned pointers during the concurrent mark phase. We'll use this information to estimate scan work for the next cycle. Currently this aggregates the work counter in gcWork and dispose atomically aggregates this into a global work counter. dispose happens relatively infrequently, so the contention on the global counter should be low. If this turns out to be an issue, we can reduce the number of disposes, and if it's still a problem, we can switch to per-P counters. Change-Id: Iac0364c466ee35fab781dbbbe7970a5f3c4e1fc1 Reviewed-on: https://go-review.googlesource.com/8832 Reviewed-by: Rick Hudson <rlh@golang.org>
Diffstat (limited to 'src/runtime/mgcwork.go')
-rw-r--r--src/runtime/mgcwork.go12
1 files changed, 12 insertions, 0 deletions
diff --git a/src/runtime/mgcwork.go b/src/runtime/mgcwork.go
index acd8e48309..fbe4d03adf 100644
--- a/src/runtime/mgcwork.go
+++ b/src/runtime/mgcwork.go
@@ -57,6 +57,10 @@ type gcWork struct {
// Bytes marked (blackened) on this gcWork. This is aggregated
// into work.bytesMarked by dispose.
bytesMarked uint64
+
+ // Scan work performed on this gcWork. This is aggregated into
+ // gcController by dispose.
+ scanWork int64
}
// initFromCache fetches work from this M's currentwbuf cache.
@@ -164,6 +168,10 @@ func (w *gcWork) dispose() {
xadd64(&work.bytesMarked, int64(w.bytesMarked))
w.bytesMarked = 0
}
+ if w.scanWork != 0 {
+ xaddint64(&gcController.scanWork, w.scanWork)
+ w.scanWork = 0
+ }
}
// disposeToCache returns any cached pointers to this M's currentwbuf.
@@ -181,6 +189,10 @@ func (w *gcWork) disposeToCache() {
xadd64(&work.bytesMarked, int64(w.bytesMarked))
w.bytesMarked = 0
}
+ if w.scanWork != 0 {
+ xaddint64(&gcController.scanWork, w.scanWork)
+ w.scanWork = 0
+ }
}
// balance moves some work that's cached in this gcWork back on the