]> Cypherpunks repositories - gostls13.git/commit
runtime: avoid double-scanning of stacks
authorAustin Clements <austin@google.com>
Thu, 28 May 2015 16:37:12 +0000 (12:37 -0400)
committerAustin Clements <austin@google.com>
Tue, 2 Jun 2015 19:59:05 +0000 (19:59 +0000)
commit724f8298a80e151088cd5f9342632b6b407fed08
treef5bcb9a1c836abfa204c7a97c243aa35faf4cf9f
parent3f6e69aca585ceaf82595170e5aea5b25a9d29ec
runtime: avoid double-scanning of stacks

Currently there's a race between stopg scanning another G's stack and
the G reaching a preemption point and scanning its own stack. When
this race occurs, the G's stack is scanned twice. Currently this is
okay, so this race is benign.

However, we will shortly be adding stack barriers during the first
stack scan, so scanning will no longer be idempotent. To prepare for
this, this change ensures that each stack is scanned only once during
each GC phase by checking the flag that indicates that the stack has
been scanned in this phase before scanning the stack.

Change-Id: Id9f4d5e2e5b839bc3f200ec1723a4a12dd677ab4
Reviewed-on: https://go-review.googlesource.com/10458
Reviewed-by: Rick Hudson <rlh@golang.org>
src/runtime/mgcmark.go
src/runtime/stack1.go