-
Notifications
You must be signed in to change notification settings - Fork 18.7k
Closed
Labels
Milestone
Description
What version of Go are you using (go version)?
Tested on both go version go1.8.1 linux/amd64 and go version devel +8c49c06b48 Mon May 8 15:16:21 2017 +0000 linux/amd64.
What operating system and processor architecture are you using (go env)?
linux/amd64
What did you do?
runtime.gchelper ends with the following few lines:
nproc := work.nproc // work.nproc can change right after we increment work.ndone
if atomic.Xadd(&work.ndone, +1) == nproc-1 {
notewakeup(&work.alldone)
}What did you expect to see?
I expected the atomic.Xadd to act as a memory fence and force the regular load of work.nproc to happen before the atomic.
What did you see instead?
The compiler reorders the regular load to occur after the atomic.Xadd. I believe this is leading to #19305.
/cc @dr2chase @cherrymui