• Austin Clements's avatar
    runtime: remove sweep wait loop in finishsweep_m · 9a31d38f
    Austin Clements authored
    In general, finishsweep_m must block until any spans that are
    concurrently being swept have been swept. It accomplishes this by
    looping over all spans, which, as in the previous commit, takes
    ~1ms/heap GB. Unfortunately, we do this during the STW sweep
    termination phase, so multi-gigabyte heaps can push our STW time past
    10ms.
    
    However, there's no need to do this wait if the world is stopped
    because, in effect, stopping the world already had to wait for
    anything that was sweeping (and if it didn't, the wait in
    finishsweep_m would deadlock). Hence, we can simply skip this loop if
    the world is stopped, such as during sweep termination. In fact,
    currently all calls to finishsweep_m are STW, but this hasn't always
    been the case and may not be the case in the future, so we keep the
    logic around.
    
    For 24GB heaps, this reduces max pause time by 75% relative to tip and
    by 90% relative to Go 1.5. Notably, all pauses are now well under
    10ms. Here are the results for the garbage benchmark:
    
                   ------------- max pause ------------
    Heap   Procs   after change   before change   1.5.1
    24GB     12        3.8ms          16ms         37ms
    24GB      4        3.7ms          16ms         37ms
     4GB      4        3.7ms           3ms        6.9ms
    
    In the 4GB/4P case, it seems the "before change" run got lucky: the
    max went up, but the 99%ile pause time went down from 3ms to 2.04ms.
    
    Change-Id: Ica22189559f231d408ef2815019c9dbb5f38bf31
    Reviewed-on: https://go-review.googlesource.com/15071Reviewed-by: 's avatarRick Hudson <rlh@golang.org>
    Run-TryBot: Austin Clements <austin@google.com>
    TryBot-Result: Gobot Gobot <gobot@golang.org>
    9a31d38f
Name
Last commit
Last update
..
archive Loading commit data...
bufio Loading commit data...
builtin Loading commit data...
bytes Loading commit data...
cmd Loading commit data...
compress Loading commit data...
container Loading commit data...
crypto Loading commit data...
database/sql Loading commit data...
debug Loading commit data...
encoding Loading commit data...
errors Loading commit data...
expvar Loading commit data...
flag Loading commit data...
fmt Loading commit data...
go Loading commit data...
hash Loading commit data...
html Loading commit data...
image Loading commit data...
index/suffixarray Loading commit data...
internal Loading commit data...
io Loading commit data...
log Loading commit data...
math Loading commit data...
mime Loading commit data...
net Loading commit data...
os Loading commit data...
path Loading commit data...
reflect Loading commit data...
regexp Loading commit data...
runtime Loading commit data...
sort Loading commit data...
strconv Loading commit data...
strings Loading commit data...
sync Loading commit data...
syscall Loading commit data...
testing Loading commit data...
text Loading commit data...
time Loading commit data...
unicode Loading commit data...
unsafe Loading commit data...
Make.dist Loading commit data...
all.bash Loading commit data...
all.bat Loading commit data...
all.rc Loading commit data...
androidtest.bash Loading commit data...
bootstrap.bash Loading commit data...
buildall.bash Loading commit data...
clean.bash Loading commit data...
clean.bat Loading commit data...
clean.rc Loading commit data...
iostest.bash Loading commit data...
make.bash Loading commit data...
make.bat Loading commit data...
make.rc Loading commit data...
nacltest.bash Loading commit data...
race.bash Loading commit data...
race.bat Loading commit data...
run.bash Loading commit data...
run.bat Loading commit data...
run.rc Loading commit data...