]> Cypherpunks repositories - gostls13.git/commit
runtime: fix scheduler race condition
authorDmitriy Vyukov <dvyukov@google.com>
Wed, 12 Jun 2013 14:46:35 +0000 (18:46 +0400)
committerDmitriy Vyukov <dvyukov@google.com>
Wed, 12 Jun 2013 14:46:35 +0000 (18:46 +0400)
commitdbcfed93e75b91819bd01eb228996073b18c8196
tree250e6bad4ce3e1991a78f02aee6e623f58ad958b
parente5cbebc1ad3f1a6372bd1a0ac6032c6236f38f6b
runtime: fix scheduler race condition
In starttheworld() we assume that P's with local work
are situated in the beginning of idle P list.
However, once we start the first M, it can execute all local G's
and steal G's from other P's.
That breaks the assumption above. Thus starttheworld() will fail
to start some P's with local work.
It seems that it can not lead to very bad things, but still
it's wrong and breaks other assumtions
(e.g. we can have a spinning M with local work).
The fix is to collect all P's with local work first,
and only then start them.

R=golang-dev, rsc
CC=golang-dev
https://golang.org/cl/10051045
src/pkg/runtime/proc.c