Descriptionruntime: 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;
Patch Set 1 #Patch Set 2 : diff -r 6883846dfe42 https://dvyukov%40google.com@code.google.com/p/go/ #Patch Set 3 : diff -r b31de657acdb https://dvyukov%40google.com@code.google.com/p/go/ #Patch Set 4 : diff -r b31de657acdb https://dvyukov%40google.com@code.google.com/p/go/ #Patch Set 5 : diff -r fa13899da667 https://dvyukov%40google.com@code.google.com/p/go/ #MessagesTotal messages: 8
|