]> Cypherpunks repositories - gostls13.git/commit
runtime: free dead G stacks concurrently
authorAustin Clements <austin@google.com>
Fri, 11 Mar 2016 22:00:46 +0000 (17:00 -0500)
committerAustin Clements <austin@google.com>
Tue, 26 Apr 2016 23:39:55 +0000 (23:39 +0000)
commite8337491aa6b6a5f96f31077764352549dc34159
treed92c2fea4141d34e0c05d15f08dbaf90ff3a5e18
parent1a2cf91f5e9e3dfb0873e61ed6907cc365857f6c
runtime: free dead G stacks concurrently

Currently we free cached stacks of dead Gs during STW stack root
marking. We do this during STW because there's no way to take
ownership of a particular dead G, so attempting to free a dead G's
stack during concurrent stack root marking could race with reusing
that G.

However, we can do this concurrently if we take a completely different
approach. One way to prevent reuse of a dead G is to remove it from
the free G list. Hence, this adds a new fixed root marking task that
simply removes all Gs from the list of dead Gs with cached stacks,
frees their stacks, and then adds them to the list of dead Gs without
cached stacks.

This is also a necessary step toward rescanning only dirty stacks,
since it eliminates another task from STW stack marking.

Change-Id: Iefbad03078b284a2e7bf30fba397da4ca87fe095
Reviewed-on: https://go-review.googlesource.com/20665
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