MFC r212115:
Fix a bug with sched_affinity() where it checks td_pinned of another
thread in a racy manner, which can lead to attempting to migrate a
thread that is pinned to a CPU. Instead, have sched_switch() determine
which CPU a thread should run on if the current one is not allowed.
KASSERT in sched_bind() that the thread is not yet pinned to a CPU.
KASSERT in sched_switch() that only migratable threads or those moving
due to a sched_bind() are changing CPUs.
Note that this is direct commit as ipi_cpu() only exists in CURRENT.
git-svn-id: svn://svn.freebsd.org/base/stable/8@212666
ccf9f872-aa2e-dd11-9fc8-
001c23d0bc1f