linux.conf.au, January 2003 PROGRAMMING: kernel/sched.c /* * Current runqueue is empty, or rebalance tick: if there is an * inbalance (current runqueue is too short) then pull from * busiest runqueue(s). * * We call this with the current runqueue locked, * irqs disabled. */ static void load_balance(runqueue_t *this_rq, int idle) { int imbalance, idx, this_cpu = smp_processor_id(); runqueue_t *busiest; prio_array_t *array; list_t *head, *curr; task_t *tmp; busiest = find_busiest_queue(this_rq, this_cpu, idle, &imbalance); if (!busiest) goto out; /* * We first consider expired tasks. Those will likely not be * executed in the near future, and they are most likely to * be cache-cold, thus switching CPUs has the least effect * on them. */ if (busiest->expired->nr_active) array = busiest->expired; else array = busiest->active;