Skip to content

Commit a1f7db8

Browse files
committed
runtime: document scanstack
Also mark it go:systemstack and explain why. Change-Id: I88baf22741c04012ba2588d8e03dd3801d19b5c0 Reviewed-on: https://go-review.googlesource.com/23390 Run-TryBot: Austin Clements <[email protected]> TryBot-Result: Gobot Gobot <[email protected]> Reviewed-by: Rick Hudson <[email protected]>
1 parent a689f6b commit a1f7db8

File tree

1 file changed

+10
-0
lines changed

1 file changed

+10
-0
lines changed

src/runtime/mgcmark.go

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -642,7 +642,17 @@ func gcFlushBgCredit(scanWork int64) {
642642
unlock(&work.assistQueue.lock)
643643
}
644644

645+
// scanstack scans gp's stack, greying all pointers found on the stack.
646+
//
647+
// During mark phase, it also installs stack barriers while traversing
648+
// gp's stack. During mark termination, it stops scanning when it
649+
// reaches an unhit stack barrier.
650+
//
651+
// scanstack is marked go:systemstack because it must not be preempted
652+
// while using a workbuf.
653+
//
645654
//go:nowritebarrier
655+
//go:systemstack
646656
func scanstack(gp *g) {
647657
if gp.gcscanvalid {
648658
return

0 commit comments

Comments
 (0)