FreeBSD/sys/kern/sched_ule.c
/*
 * Transfer load between two imbalanced thread queues.
 */
Transfer load between two imbalanced thread queues.
Transfer load between two imbalanced thread queues .
static int
sched_balance_pair(struct tdq *high, struct tdq *low)
{
	int moved;
	int cpu;
	tdq_lock_pair(high, low);
	moved = 0;
	if (high->tdq_transferable != 0 && high->tdq_load > low->tdq_load &&
	    (moved = tdq_move(high, low)) > 0) {
		cpu = TDQ_ID(low);
		if (cpu != PCPU_GET(cpuid))
			ipi_cpu(cpu, IPI_PREEMPT);
	}
	tdq_unlock_pair(high, low);
	return (moved);
}
static int sched_balance_pair ( struct tdq * high , struct tdq * low ) { int moved ; int cpu ; tdq_lock_pair ( high , low ) ; moved = 0 ; if ( high -> tdq_transferable != 0 && high -> tdq_load > low -> tdq_load && ( moved = tdq_move ( high , low ) ) > 0 ) { cpu = TDQ_ID ( low ) ; if ( cpu != PCPU_GET ( cpuid ) ) ipi_cpu ( cpu , IPI_PREEMPT ) ; } tdq_unlock_pair ( high , low ) ; return ( moved ) ; }
Transfer load between two imbalanced thread queues.
Transfer load between two imbalanced thread queues .
/*
	 * Determine what the imbalance is and then adjust that to how many
	 * threads we actually have to give up (transferable).
	 */ /*
		 * In case the target isn't the current cpu IPI it to force a
		 * reschedule with the new workload.
		 */