go/src
Austin Clements c8bd293e56 runtime: eliminate floating garbage estimate
Currently when we compute the trigger for the next GC, we do it based
on an estimate of the reachable heap size at the start of the GC
cycle, which is itself based on an estimate of the floating garbage.
This was introduced by 4655aad to fix a bad feedback loop that allowed
the heap to grow to many times the true reachable size.

However, this estimate gets easily confused by rapidly allocating
applications, and, worse it's different than the heap size the trigger
controller uses to compute the trigger itself. This results in the
trigger controller often thinking that GC finished before it started.
Since this would be a pretty great outcome from it's perspective, it
sets the trigger for the next cycle as close to the next goal as
possible (which is limited to 95% of the goal).

Furthermore, the bad feedback loop this estimate originally fixed
seems not to happen any more, suggesting it was fixed more correctly
by some other change in the mean time. Finally, with the change to
allocate black, it shouldn't even be theoretically possible for this
bad feedback loop to occur.

Hence, eliminate the floating garbage estimate and simply consider the
reachable heap to be the marked heap. This harms overall throughput
slightly for allocation-heavy benchmarks, but significantly improves
mutator availability.

Fixes #12204. This brings the average trigger in this benchmark from
0.95 (the cap) to 0.7 and the active GC utilization from ~90% to ~45%.

Updates #14951. This makes the trigger controller much better behaved,
so it pulls the trigger lower if assists are consuming a lot of CPU
like it's supposed to, increasing mutator availability.

name              old time/op  new time/op  delta
XBenchGarbage-12  2.21ms ± 1%  2.28ms ± 3%  +3.29%  (p=0.000 n=17+17)

Some of this slow down we paid for in earlier commits. Relative to the
start of the series to switch to allocate-black (the parent of "count
black allocations toward scan work"), the garbage benchmark is 2.62%
slower.

name                      old time/op    new time/op    delta
BinaryTree17-12              2.53s ± 3%     2.53s ± 3%    ~     (p=0.708 n=20+19)
Fannkuch11-12                2.08s ± 0%     2.08s ± 0%  -0.22%  (p=0.002 n=19+18)
FmtFprintfEmpty-12          45.3ns ± 2%    45.2ns ± 3%    ~     (p=0.505 n=20+20)
FmtFprintfString-12          129ns ± 0%     131ns ± 2%  +1.80%  (p=0.000 n=16+19)
FmtFprintfInt-12             121ns ± 2%     121ns ± 2%    ~     (p=0.768 n=19+19)
FmtFprintfIntInt-12          186ns ± 1%     188ns ± 3%  +0.99%  (p=0.000 n=19+19)
FmtFprintfPrefixedInt-12     188ns ± 1%     188ns ± 1%    ~     (p=0.947 n=18+16)
FmtFprintfFloat-12           254ns ± 1%     255ns ± 1%  +0.30%  (p=0.002 n=19+17)
FmtManyArgs-12               763ns ± 0%     770ns ± 0%  +0.92%  (p=0.000 n=18+18)
GobDecode-12                7.00ms ± 1%    7.04ms ± 1%  +0.61%  (p=0.049 n=20+20)
GobEncode-12                5.88ms ± 1%    5.88ms ± 0%    ~     (p=0.641 n=18+19)
Gzip-12                      214ms ± 1%     215ms ± 1%  +0.43%  (p=0.002 n=18+19)
Gunzip-12                   37.6ms ± 0%    37.6ms ± 0%  +0.11%  (p=0.015 n=17+18)
HTTPClientServer-12         76.9µs ± 2%    78.1µs ± 2%  +1.44%  (p=0.000 n=20+18)
JSONEncode-12               15.2ms ± 2%    15.1ms ± 1%    ~     (p=0.271 n=19+18)
JSONDecode-12               53.1ms ± 1%    53.3ms ± 0%  +0.49%  (p=0.000 n=18+19)
Mandelbrot200-12            4.04ms ± 1%    4.03ms ± 0%  -0.33%  (p=0.005 n=18+18)
GoParse-12                  3.29ms ± 1%    3.28ms ± 1%    ~     (p=0.146 n=16+17)
RegexpMatchEasy0_32-12      69.9ns ± 3%    69.5ns ± 1%    ~     (p=0.785 n=20+19)
RegexpMatchEasy0_1K-12       237ns ± 0%     237ns ± 0%    ~     (p=1.000 n=18+18)
RegexpMatchEasy1_32-12      69.5ns ± 1%    69.2ns ± 1%  -0.44%  (p=0.020 n=16+19)
RegexpMatchEasy1_1K-12       372ns ± 1%     371ns ± 2%    ~     (p=0.086 n=20+19)
RegexpMatchMedium_32-12      108ns ± 3%     107ns ± 1%  -1.00%  (p=0.004 n=19+14)
RegexpMatchMedium_1K-12     34.2µs ± 4%    34.0µs ± 2%    ~     (p=0.380 n=19+20)
RegexpMatchHard_32-12       1.77µs ± 4%    1.76µs ± 3%    ~     (p=0.558 n=18+20)
RegexpMatchHard_1K-12       53.4µs ± 4%    52.8µs ± 2%  -1.10%  (p=0.020 n=18+20)
Revcomp-12                   359ms ± 4%     377ms ± 0%  +5.19%  (p=0.000 n=20+18)
Template-12                 63.7ms ± 2%    62.9ms ± 2%  -1.27%  (p=0.005 n=18+20)
TimeParse-12                 316ns ± 2%     313ns ± 1%    ~     (p=0.059 n=20+16)
TimeFormat-12                329ns ± 0%     331ns ± 0%  +0.39%  (p=0.000 n=16+18)
[Geo mean]                  51.6µs         51.7µs       +0.18%

Change-Id: I1dce4640c8205d41717943b021039fffea863c57
Reviewed-on: https://go-review.googlesource.com/21324
Reviewed-by: Rick Hudson <rlh@golang.org>
Run-TryBot: Austin Clements <austin@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
2016-04-21 20:07:25 +00:00
..
archive archive/tar: style nit: s/nano_buf/nanoBuf/ 2016-04-15 21:29:18 +00:00
bufio all: replace magic 0x80 with named constant utf8.RuneSelf 2016-04-10 15:15:57 +00:00
builtin
bytes all: remove unnecessary type conversions 2016-04-15 07:31:45 +00:00
cmd testing: add matching of subtest 2016-04-21 19:58:31 +00:00
compress compress/flate: use uncompressed if dynamic encoding is larger 2016-04-18 02:30:46 +00:00
container container/heap: correct number of elements in BenchmarkDup 2016-04-20 15:26:05 +00:00
context context: attempt to deflake timing tests 2016-04-11 23:15:02 +00:00
crypto crypto/md5: add assembly implementation on ppc64le 2016-04-20 21:38:01 +00:00
database/sql all: delete dead non-test code 2016-03-25 06:28:13 +00:00
debug debug/pe: introduce Section.Relocs 2016-04-21 06:35:48 +00:00
encoding encoding/json: update docs to not use misuse the term "object" 2016-04-16 22:11:57 +00:00
errors
expvar expvar: Ensure strings are written as valid JSON. 2016-04-06 03:52:39 +00:00
flag
fmt fmt: remove extra space in doc for compound objects 2016-04-17 20:07:32 +00:00
go go/types: trailing semis are ok after valid fallthrough 2016-04-19 21:44:44 +00:00
hash hash/adler32: Unroll loop for extra performance. 2016-04-15 10:17:17 +00:00
html html/template: add examples of loading templates from files 2016-04-13 02:28:28 +00:00
image image/draw: remove some bounds checks from DrawYCbCr 2016-04-17 06:25:28 +00:00
index/suffixarray
internal internal/trace: fix int overflow in timestamps 2016-04-12 07:25:11 +00:00
io io: document WriteString calls Write exactly once 2016-04-12 01:03:51 +00:00
log
math math/big: more tests, documentation for Flot gob marshalling 2016-04-20 21:16:21 +00:00
mime all: standardize RFC mention format 2016-04-12 21:07:52 +00:00
net net: add support for Zone of IPNet 2016-04-19 09:21:57 +00:00
os all: remove unnecessary type conversions 2016-04-15 07:31:45 +00:00
path all: use bytes.Equal, bytes.Contains and strings.Contains, again 2016-04-11 15:16:54 +00:00
reflect reflect: test that method name offset is valid 2016-04-18 19:13:36 +00:00
regexp all: remove unnecessary type conversions 2016-04-15 07:31:45 +00:00
runtime runtime: eliminate floating garbage estimate 2016-04-21 20:07:25 +00:00
sort all: delete dead non-test code 2016-03-25 06:28:13 +00:00
strconv strconv: fix ParseFloat for special forms of zero values 2016-04-19 22:39:43 +00:00
strings all: remove unnecessary type conversions 2016-04-15 07:31:45 +00:00
sync all: remove unnecessary type conversions 2016-04-15 07:31:45 +00:00
syscall syscall: fix epoll_event struct for ppc64le/ppc64 2016-04-13 20:58:46 +00:00
testing testing: add matching of subtest 2016-04-21 19:58:31 +00:00
text text/template: emit field error over nil pointer error where appropriate 2016-04-10 23:29:29 +00:00
time all: remove unnecessary type conversions 2016-04-15 07:31:45 +00:00
unicode all: remove unnecessary type conversions 2016-04-15 07:31:45 +00:00
unsafe
vendor/golang.org/x/net/http2/hpack all: fix spelling mistakes 2016-04-03 17:03:15 +00:00
Make.dist
all.bash
all.bat
all.rc
androidtest.bash
bootstrap.bash
buildall.bash
clean.bash
clean.bat
clean.rc
iostest.bash
make.bash cmd/dist: redo flag-passing for bootstrap 2016-03-18 19:00:03 +00:00
make.bat
make.rc
naclmake.bash src: split nacltest.bash into naclmake.bash and keep nacltest.bash 2016-04-12 02:03:34 +00:00
nacltest.bash src: split nacltest.bash into naclmake.bash and keep nacltest.bash 2016-04-12 02:03:34 +00:00
race.bash
race.bat
run.bash
run.bat
run.rc