FreeBSD/sys/kern/sched_ule.c
/*
 * Notify a remote cpu of new work.  Sends an IPI if criteria are met.
 */
Notify a remote cpu of new work.  Sends an IPI if criteria are met.
Notify a remote cpu of new work . Sends an IPI if criteria are met .
static void
tdq_notify(struct tdq *tdq, struct thread *td)
{
	struct thread *ctd;
	int pri;
	int cpu;
	if (tdq->tdq_ipipending)
		return;
	cpu = td_get_sched(td)->ts_cpu;
	pri = td->td_priority;
	ctd = pcpu_find(cpu)->pc_curthread;
	if (!sched_shouldpreempt(pri, ctd->td_priority, 1))
		return;
	atomic_thread_fence_seq_cst();
	if (TD_IS_IDLETHREAD(ctd)) {
		if (!tdq->tdq_cpu_idle || cpu_idle_wakeup(cpu))
			return;
	}
	tdq->tdq_ipipending = 1;
	ipi_cpu(cpu, IPI_PREEMPT);
}
static void tdq_notify ( struct tdq * tdq , struct thread * td ) { struct thread * ctd ; int pri ; int cpu ; if ( tdq -> tdq_ipipending ) return ; cpu = td_get_sched ( td ) -> ts_cpu ; pri = td -> td_priority ; ctd = pcpu_find ( cpu ) -> pc_curthread ; if ( ! sched_shouldpreempt ( pri , ctd -> td_priority , 1 ) ) return ; atomic_thread_fence_seq_cst ( ) ; if ( TD_IS_IDLETHREAD ( ctd ) ) { if ( ! tdq -> tdq_cpu_idle || cpu_idle_wakeup ( cpu ) ) return ; } tdq -> tdq_ipipending = 1 ; ipi_cpu ( cpu , IPI_PREEMPT ) ; }
Notify a remote cpu of new work.
Notify a remote cpu of new work .
/*
	 * Make sure that our caller's earlier update to tdq_load is
	 * globally visible before we read tdq_cpu_idle.  Idle thread
	 * accesses both of them without locks, and the order is important.
	 */ /*
		 * If the MD code has an idle wakeup routine try that before
		 * falling back to IPI.
		 */