• Austin Clements's avatar
    runtime: reset mark state before stopping the world · af190578
    Austin Clements authored
    Currently we reset the mark state during STW sweep termination. This
    involves looping over all of the goroutines. Each iteration of this
    loop takes ~25ns, so at around 400k goroutines, we'll exceed our 10ms
    pause goal.
    
    However, it's safe to do this before we stop the world for sweep
    termination because nothing is consuming this state yet. Hence, move
    the reset to just before STW.
    
    This isn't perfect: a long reset can still delay allocating goroutines
    that block on GC starting. But it's certainly better to block some
    things eventually than to block everything immediately.
    
    For 1.6.x.
    
    Fixes #14420.
    
    name \ 95%ile-time/sweepTerm           old          new  delta
    500kIdleGs-12                 11312µs ± 6%  18.9µs ± 6%  -99.83%  (p=0.000 n=16+20)
    
    Change-Id: I9815c4d8d9b0d3c3e94dfdab78049cefe0dcc93c
    Reviewed-on: https://go-review.googlesource.com/20147Reviewed-by: 's avatarRick Hudson <rlh@golang.org>
    Run-TryBot: Austin Clements <austin@google.com>
    TryBot-Result: Gobot Gobot <gobot@golang.org>
    Reviewed-on: https://go-review.googlesource.com/22043Reviewed-by: 's avatarAustin Clements <austin@google.com>
    af190578
Name
Last commit
Last update
api Loading commit data...
doc Loading commit data...
lib/time Loading commit data...
misc Loading commit data...
src Loading commit data...
test Loading commit data...
.gitattributes Loading commit data...
.gitignore Loading commit data...
AUTHORS Loading commit data...
CONTRIBUTING.md Loading commit data...
CONTRIBUTORS Loading commit data...
LICENSE Loading commit data...
PATENTS Loading commit data...
README.md Loading commit data...
VERSION Loading commit data...
favicon.ico Loading commit data...
robots.txt Loading commit data...