Fix sched_stop_secondary_cpus() to properly drain CPUs
authormatthew <matthew@openbsd.org>
Sun, 13 Jul 2014 21:44:58 +0000 (21:44 +0000)
committermatthew <matthew@openbsd.org>
Sun, 13 Jul 2014 21:44:58 +0000 (21:44 +0000)
commitd3a769668613a0f9f6a071596a953d698d547b52
tree2256e72e00dbb9ef63bdc3699e40f952706ec6c4
parentd119345d76d3f4b0ac898e0c33d180237c68c2b5
Fix sched_stop_secondary_cpus() to properly drain CPUs

TAILQ_FOREACH() isn't safe to use in sched_chooseproc() to iterate
over the run queues because within the loop body we remove the threads
from their run queues and reinsert them elsewhere.  As a result, we
end up only draining the first thread of each run queue rather than
all of them.

ok kettenis
sys/kern/kern_sched.c