1
0
mirror of https://github.com/golang/go synced 2024-10-04 21:21:22 -06:00
go/src
Austin Clements 1fb01a88f9 runtime: revise assist ratio aggressively
At the start of a GC cycle, the garbage collector computes the assist
ratio based on the total scannable heap size. This was intended to be
conservative; after all, this assumes the entire heap may be reachable
and hence needs to be scanned. But it only assumes that the *current*
entire heap may be reachable. It fails to account for heap allocated
during the GC cycle. If the trigger ratio is very low (near zero), and
most of the heap is reachable when GC starts (which is likely if the
trigger ratio is near zero), then it's possible for the mutator to
create new, reachable heap fast enough that the assists won't keep up
based on the assist ratio computed at the beginning of the cycle. As a
result, the heap can grow beyond the heap goal (by hundreds of megs in
stress tests like in issue #11911).

We already have some vestigial logic for dealing with situations like
this; it just doesn't run often enough. Currently, every 10 ms during
the GC cycle, the GC revises the assist ratio. This was put in before
we switched to a conservative assist ratio (when we really were using
estimates of scannable heap), and it turns out to be exactly what we
need now. However, every 10 ms is far too infrequent for a rapidly
allocating mutator.

This commit reuses this logic, but replaces the 10 ms timer with
revising the assist ratio every time the heap is locked, which
coincides precisely with when the statistics used to compute the
assist ratio are updated.

Fixes #11911.

Change-Id: I377b231ab064946228378fa10422a46d1b50f4c5
Reviewed-on: https://go-review.googlesource.com/13047
Reviewed-by: Rick Hudson <rlh@golang.org>
Reviewed-by: Russ Cox <rsc@golang.org>
2015-08-04 18:54:48 +00:00
..
archive archive/tar: don't treat multiple file system links as a tar hardlink 2015-08-04 17:34:43 +00:00
bufio bufio: Remove unneeded error initialization 2015-07-18 18:05:23 +00:00
builtin builtin: remove errant space in hyphenated adjective phrase 2015-06-28 21:41:38 +00:00
bytes Revert "bytes: document that Buffer values must not be copied" 2015-07-23 18:34:49 +00:00
cmd cmd/go: fix documentation for exported functions 2015-08-04 18:30:00 +00:00
compress all: link to https instead of http 2015-07-11 14:36:33 +00:00
container
crypto crypto/x509: mark root_darwin_armx.go as cgo-only 2015-07-30 15:47:16 +00:00
database/sql database/sql: document closing requirements for Stmts 2015-07-15 04:31:41 +00:00
debug all: cleanup usage of dashes in package documentation 2015-07-28 02:44:41 +00:00
encoding encoding/json: revert "fix decoding of JSON null values" 2015-07-30 20:00:56 +00:00
errors
expvar
flag flag: add comment stating that Set is called in sequence across the command line 2015-07-16 05:33:47 +00:00
fmt fmt: restore padding for %x on byte slices and strings 2015-06-29 07:17:23 +00:00
go go/types: remove the renaming import of go/constant 2015-08-04 01:56:58 +00:00
hash hash/crc32: speedup crc32 of IEEE using slicingBy8 2015-06-18 18:14:24 +00:00
html html/template: add examples to package and functions 2015-07-27 16:37:33 +00:00
image image/color: fix format typo in the tests. 2015-07-16 01:41:34 +00:00
index/suffixarray
internal runtime/trace: report negative frequency as a time-ordering problem 2015-07-30 20:32:01 +00:00
io io: tweak Reader comment 2015-06-29 21:17:47 +00:00
log log: fix flaky test 2015-06-18 18:08:17 +00:00
math math/rand: warn against using package for security-sensitive work 2015-07-30 12:42:18 +00:00
mime all: cleanup usage of dashes in package documentation 2015-07-28 02:44:41 +00:00
net net/http: deflake TestZeroLengthPostAndResponse 2015-08-03 16:06:52 +00:00
os os: add explicit tests for fchown(2) and lchown(2) on unix platforms 2015-07-31 19:41:42 +00:00
path all: link to https instead of http 2015-07-11 14:36:33 +00:00
reflect cmd/compile, runtime: fix placement of map bucket overflow pointer on nacl 2015-07-31 18:49:32 +00:00
regexp regexp: small correction to test comment 2015-06-14 17:09:13 +00:00
runtime runtime: revise assist ratio aggressively 2015-08-04 18:54:48 +00:00
sort
strconv strconv: add examples to package 2015-07-22 16:00:21 +00:00
strings all: link to https for golang subdomains too 2015-07-12 04:42:40 +00:00
sync runtime, sync/atomic: add memory barriers in arm cas routines 2015-07-30 20:11:11 +00:00
syscall syscall: use fchownat(2) in place of lchown(2) for linux/arm64 2015-07-30 20:30:26 +00:00
testing runtime/trace: add new package 2015-07-22 15:47:16 +00:00
text text/template: make zero Template work again 2015-06-24 22:27:33 +00:00
time time: make it clearer how to format a fractional second 2015-07-15 05:13:05 +00:00
unicode unicode: upgrade to 8.0.0 2015-06-26 18:01:29 +00:00
unsafe
all.bash
all.bat
all.rc
androidtest.bash androidtest.bash: robust cleanup in case of failure. 2015-07-17 21:12:12 +00:00
bootstrap.bash
buildall.bash
clean.bash build: fix clean scripts 2015-06-18 16:13:13 +00:00
clean.bat build: fix clean scripts 2015-06-18 16:13:13 +00:00
clean.rc build: fix clean scripts 2015-06-18 16:13:13 +00:00
iostest.bash
make.bash doc: replace references to {5..9}{g,l} with go tool compile and go tool link 2015-06-17 04:05:50 +00:00
make.bat doc: replace references to {5..9}{g,l} with go tool compile and go tool link 2015-06-17 04:05:50 +00:00
Make.dist
make.rc doc: replace references to {5..9}{g,l} with go tool compile and go tool link 2015-06-17 04:05:50 +00:00
nacltest.bash
race.bash all: link to https instead of http 2015-07-11 14:36:33 +00:00
race.bat all: link to https instead of http 2015-07-11 14:36:33 +00:00
run.bash
run.bat
run.rc