mirror of
https://github.com/golang/go.git
synced 2025-12-08 06:10:04 +00:00
runtime: proportional mutator assist
Currently, mutator allocation periodically assists the garbage collector by performing a small, fixed amount of scanning work. However, to control heap growth, mutators need to perform scanning work *proportional* to their allocation rate. This change implements proportional mutator assists. This uses the scan work estimate computed by the garbage collector at the beginning of each cycle to compute how much scan work must be performed per allocation byte to complete the estimated scan work by the time the heap reaches the goal size. When allocation triggers an assist, it uses this ratio and the amount allocated since the last assist to compute the assist work, then attempts to steal as much of this work as possible from the background collector's credit, and then performs any remaining scan work itself. Change-Id: I98b2078147a60d01d6228b99afd414ef857e4fba Reviewed-on: https://go-review.googlesource.com/8836 Reviewed-by: Rick Hudson <rlh@golang.org>
This commit is contained in:
parent
028f972847
commit
4b2fde945a
4 changed files with 95 additions and 37 deletions
|
|
@ -241,6 +241,10 @@ type g struct {
|
|||
racectx uintptr
|
||||
waiting *sudog // sudog structures this g is waiting on (that have a valid elem ptr)
|
||||
readyg *g // scratch for readyExecute
|
||||
|
||||
// Per-G gcController state
|
||||
gcalloc uintptr // bytes allocated during this GC cycle
|
||||
gcscanwork int64 // scan work done (or stolen) this GC cycle
|
||||
}
|
||||
|
||||
type mts struct {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue