]> Cypherpunks repositories - gostls13.git/commit
runtime: make assists preemptible
authorAustin Clements <austin@google.com>
Thu, 15 Oct 2015 21:58:17 +0000 (17:58 -0400)
committerAustin Clements <austin@google.com>
Tue, 3 Nov 2015 15:53:31 +0000 (15:53 +0000)
commit456528304d4a20ee438b440fd6807c3f5ca7d5e2
treeb02b4acf76a586de997e403cda341eef602f29ee
parent15aa6bbd5aa2cc8d7f2de91255f6a331ec5c16d4
runtime: make assists preemptible

Currently, assists are non-preemptible, which means a heavily
assisting G can block other Gs from running. At the beginning of a GC
cycle, it can also delay scang, which will spin until the assist is
done. Since scanning is currently done sequentially, this can
seriously extend the length of the scan phase.

Fix this by making assists preemptible. Since the assist holds work
buffers and runs on the system stack, this must be done cooperatively:
we make gcDrainN return on preemption, and make the assist return from
the system stack and voluntarily Gosched.

This is prerequisite to enlarging the work buffers. Without this
change, the delays and spinning in scang increase significantly.

This has no effect on the go1 benchmarks.

name              old time/op  new time/op  delta
XBenchGarbage-12  5.72ms ± 4%  5.37ms ± 5%  -6.11%  (p=0.000 n=20+20)

Change-Id: I829e732a0f23b126da633516a1a9ec1a508fdbf1
Reviewed-on: https://go-review.googlesource.com/15894
Reviewed-by: Rick Hudson <rlh@golang.org>
Run-TryBot: Austin Clements <austin@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
src/runtime/mgcmark.go