runtime: fix deadlock
The deadlock episodically occurs on misc/cgo/test/TestCthread. The problem is that starttheworld() leaves some P's with local work without M's. Then all active M's enter into syscalls, but reject to wake another M's due to the following check (both in entersyscallblock() and in retake()): if(p->runqhead == p->runqtail && runtime·atomicload(&runtime·sched.nmspinning) + runtime·atomicload(&runtime·sched.npidle) > 0) continue; R=rsc CC=golang-dev https://golang.org/cl/7424054
Showing
Please
register
or
sign in
to comment