FreeBSD/sys/kern/sched_ule.c
/*
 * Enforce affinity settings for a thread.  Called after adjustments to
 * cpumask.
 */
Enforce affinity settings for a thread.  Called after adjustments to
cpumask.
Enforce affinity settings for a thread . Called after adjustments to cpumask .
void
sched_affinity(struct thread *td)
{
#ifdef SMP
	struct td_sched *ts;
	THREAD_LOCK_ASSERT(td, MA_OWNED);
	ts = td_get_sched(td);
	if (THREAD_CAN_SCHED(td, ts->ts_cpu))
		return;
	if (TD_ON_RUNQ(td)) {
		sched_rem(td);
		sched_add(td, SRQ_BORING);
		return;
	}
	if (!TD_IS_RUNNING(td))
		return;
	td->td_flags |= TDF_NEEDRESCHED;
	if (td != curthread)
		ipi_cpu(ts->ts_cpu, IPI_PREEMPT);
#endif
}
void sched_affinity ( struct thread * td ) { #ifdef SMP struct td_sched * ts ; THREAD_LOCK_ASSERT ( td , MA_OWNED ) ; ts = td_get_sched ( td ) ; if ( THREAD_CAN_SCHED ( td , ts -> ts_cpu ) ) return ; if ( TD_ON_RUNQ ( td ) ) { sched_rem ( td ) ; sched_add ( td , SRQ_BORING ) ; return ; } if ( ! TD_IS_RUNNING ( td ) ) return ; td -> td_flags |= TDF_NEEDRESCHED ; if ( td != curthread ) ipi_cpu ( ts -> ts_cpu , IPI_PREEMPT ) ; #endif }
Enforce affinity settings for a thread.
Enforce affinity settings for a thread .
/*
	 * Force a switch before returning to userspace.  If the
	 * target thread is not running locally send an ipi to force
	 * the issue.
	 */