]> Cypherpunks repositories - gostls13.git/commitdiff
runtime: document scanstack
authorAustin Clements <austin@google.com>
Tue, 24 May 2016 02:05:51 +0000 (22:05 -0400)
committerAustin Clements <austin@google.com>
Wed, 25 May 2016 21:11:44 +0000 (21:11 +0000)
Also mark it go:systemstack and explain why.

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

index cbdf2b8375149d185a2a179e36b4106a6b57fc2a..b0e7477d50d9e44c52effc2b2db9b364b79f5fe9 100644 (file)
@@ -642,7 +642,17 @@ func gcFlushBgCredit(scanWork int64) {
        unlock(&work.assistQueue.lock)
 }
 
+// scanstack scans gp's stack, greying all pointers found on the stack.
+//
+// During mark phase, it also installs stack barriers while traversing
+// gp's stack. During mark termination, it stops scanning when it
+// reaches an unhit stack barrier.
+//
+// scanstack is marked go:systemstack because it must not be preempted
+// while using a workbuf.
+//
 //go:nowritebarrier
+//go:systemstack
 func scanstack(gp *g) {
        if gp.gcscanvalid {
                return