diff options
| author | Austin Clements <austin@google.com> | 2015-07-31 13:52:17 -0400 |
|---|---|---|
| committer | Austin Clements <austin@google.com> | 2015-08-04 18:54:32 +0000 |
| commit | 88e945fd231b40a41955f2b8505f680a83520fbf (patch) | |
| tree | 5cc724fa73c719545bfc9bb9b04036c42aaf00b3 /src/runtime/malloc.go | |
| parent | d5f5e658aef1103944b514a10f987690fe9ec0d3 (diff) | |
| download | go-88e945fd231b40a41955f2b8505f680a83520fbf.tar.xz | |
runtime: recheck GC trigger before actually starting GC
Currently allocation checks the GC trigger speculatively during
allocation and then triggers the GC without rechecking. As a result,
it's possible for G 1 and G 2 to detect the trigger simultaneously,
both enter startGC, G 1 actually starts GC while G 2 gets preempted
until after the whole GC cycle, then G 2 immediately starts another GC
cycle even though the heap is now well under the trigger.
Fix this by re-checking the GC trigger non-speculatively just before
actually kicking off a new GC cycle.
This contributes to #11911 because when this happens, we definitely
don't finish the background sweep before starting the next GC cycle,
which can significantly delay the start of concurrent scan.
Change-Id: I560ab79ba5684ba435084410a9765d28f5745976
Reviewed-on: https://go-review.googlesource.com/13025
Reviewed-by: Russ Cox <rsc@golang.org>
Reviewed-by: Rick Hudson <rlh@golang.org>
Diffstat (limited to 'src/runtime/malloc.go')
0 files changed, 0 insertions, 0 deletions
