]> Cypherpunks repositories - gostls13.git/commit
runtime: include scalar slots in GC scan work metric
authorAustin Clements <austin@google.com>
Mon, 4 May 2015 19:40:58 +0000 (15:40 -0400)
committerAustin Clements <austin@google.com>
Wed, 6 May 2015 19:40:27 +0000 (19:40 +0000)
commit53c53984e7ae789c3a1dda0ef4d8f6e760753faa
treecac237b9edbb88f07787c0f14bd387331df3d829
parentc4931a84332cd9528138651f9c12ab6d63921c68
runtime: include scalar slots in GC scan work metric

The garbage collector predicts how much "scan work" must be done in a
cycle to determine how much work should be done by mutators when they
allocate. Most code doesn't care what units the scan work is in: it
simply knows that a certain amount of scan work has to be done in the
cycle. Currently, the GC uses the number of pointer slots scanned as
the scan work on the theory that this is the bulk of the time spent in
the garbage collector and hence reflects real CPU resource usage.
However, this metric is difficult to estimate at the beginning of a
cycle.

Switch to counting the total number of bytes scanned, including both
pointer and scalar slots. This is still less than the total marked
heap since it omits no-scan objects and no-scan tails of objects. This
metric may not reflect absolute performance as well as the count of
scanned pointer slots (though it still takes time to scan scalar
fields), but it will be much easier to estimate robustly, which is
more important.

Change-Id: Ie3a5eeeb0384a1ca566f61b2f11e9ff3a75ca121
Reviewed-on: https://go-review.googlesource.com/9694
Reviewed-by: Russ Cox <rsc@golang.org>
src/runtime/mgcmark.go