go/src
Austin Clements eee85fc5a1 runtime: snapshot heap profile during mark termination
Currently we snapshot the heap profile just *after* mark termination
starts the world because it's a relatively expensive operation.
However, this means any alloc or free events that happen between
starting the world and snapshotting the heap profile can be accounted
to the wrong cycle. In the worst case, a free can be accounted to the
cycle before the alloc; if the heap is small, this can result
temporarily in a negative "in use" count in the profile.

Fix this without making STW more expensive by using a global heap
profile cycle counter. This lets us split up the operation into a two
parts: 1) a super-cheap snapshot operation that simply increments the
global cycle counter during STW, and 2) a more expensive cleanup
operation we can do after starting the world that frees up a slot in
all buckets for use by the next heap profile cycle.

Fixes #19311.

Change-Id: I6bdafabf111c48b3d26fe2d91267f7bef0bd4270
Reviewed-on: https://go-review.googlesource.com/37714
Run-TryBot: Austin Clements <austin@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Rick Hudson <rlh@golang.org>
2017-03-31 01:14:56 +00:00
..
archive archive/zip: parallelize benchmarks 2017-03-15 18:26:51 +00:00
bufio
builtin
bytes bytes: fix typo in comment 2017-03-22 19:41:54 +00:00
cmd cmd/compile: remove confusing comment, fix comment for symExport 2017-03-31 00:54:15 +00:00
compress
container
context
crypto crypto/*: fix spelling of 'below' 2017-03-20 16:03:18 +00:00
database/sql database/sql: fix spelling mistake in tests 2017-03-08 18:27:19 +00:00
debug debug/pe: add TestBuildingWindowsGUI 2017-03-30 01:19:57 +00:00
encoding encoding/gob: Speedup map decoding by reducing the allocations. 2017-03-24 19:36:14 +00:00
errors
expvar expvar: add benchmark for (*Map).Set with per-goroutine keys 2017-03-10 19:09:48 +00:00
flag flag: validate Int and Uint values to be in range 2017-03-21 17:00:26 +00:00
fmt
go go/build: remove unused returnImports parameter 2017-03-21 02:47:36 +00:00
hash hash/crc32: improve performance for ppc64le 2017-03-17 12:28:57 +00:00
html text/template,html/template: state that Funcs must happen before parsing 2017-03-21 04:07:35 +00:00
image image/png: decode Gray8 transparent images. 2017-03-17 07:50:05 +00:00
index/suffixarray
internal cmd/link: skip TestDWARF when cgo is disabled 2017-03-30 22:32:33 +00:00
io
log
math math: speed up Log on amd64 2017-03-29 20:36:29 +00:00
mime mime: handling invalid mime media parameters 2017-03-17 13:59:31 +00:00
net net, net/http: adjust time-in-past constant even earlier 2017-03-29 17:18:13 +00:00
os os: parse command line without shell32.dll 2017-03-24 00:53:03 +00:00
path
plugin
reflect reflect: fix out-of-bounds pointers calling no-result method 2017-03-29 15:28:49 +00:00
regexp regexp: reduce allocations at makeOnePass 2017-03-29 20:35:08 +00:00
runtime runtime: snapshot heap profile during mark termination 2017-03-31 01:14:56 +00:00
sort
strconv strconv: optimize decimal ints formatting with smallsString 2017-03-22 16:03:28 +00:00
strings
sync
syscall os/exec: handle Unshareflags with CLONE_NEWNS 2017-03-23 17:53:18 +00:00
testing
text text/template,html/template: state that Funcs must happen before parsing 2017-03-21 04:07:35 +00:00
time time: make the ParseInLocation test more robust 2017-03-09 18:31:42 +00:00
unicode
unsafe
vendor/golang_org/x net/http: import updated idna package and adjust request.go 2017-03-24 13:30:17 +00:00
Make.dist
all.bash
all.bat
all.rc
androidtest.bash
bootstrap.bash
buildall.bash src/*.bash: use tabs consistently 2017-03-09 21:30:31 +00:00
clean.bash
clean.bat
clean.rc
cmp.bash
iostest.bash *.bash: always use the same string equality operator 2017-03-14 21:46:31 +00:00
make.bash *.bash: always use the same string equality operator 2017-03-14 21:46:31 +00:00
make.bat
make.rc
naclmake.bash
nacltest.bash
race.bash
race.bat
run.bash *.bash: always use the same string equality operator 2017-03-14 21:46:31 +00:00
run.bat
run.rc