]> Cypherpunks repositories - gostls13.git/commit
runtime: preempt fractional worker after reaching utilization goal
authorAustin Clements <austin@google.com>
Wed, 4 Oct 2017 20:15:35 +0000 (16:15 -0400)
committerAustin Clements <austin@google.com>
Fri, 13 Oct 2017 20:53:13 +0000 (20:53 +0000)
commit28e1a8e47aa089e781aa15bdd16e15265a5180bd
treec3b5a6ced6f12f0c2dc0c4f3488e88d516e184ed
parentb783930e63f4922e8465e2cd61c3d9a131b95f2d
runtime: preempt fractional worker after reaching utilization goal

Currently fractional workers run until preempted by the scheduler,
which means they typically run for 20ms. During this time, all other
goroutines on that P are blocked, which can introduce significant
latency variance.

This modifies fractional workers to self-preempt shortly after
achieving the fractional utilization goal. In practice this means they
preempt much sooner, and the scale of their preemption is on the order
of how often the user goroutine block (so, if the application is
compute-bound, the fractional workers will also run for long times,
but if the application blocks frequently, the fractional workers will
also preempt quickly).

Fixes #21698.
Updates #18534.

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