2.3.1 O(n)调度器 - 调度逻辑
asmlinkage void schedule(void) {
next = idle_task(this_cpu);
c = -1000;
list_for_each(tmp, &runqueue_head) {
p = list_entry(tmp, struct task_struct, run_list);
if (can_schedule(p, this_cpu)) { /* 判断 p 是否可以在 this_cpu 上运行 */
int weight = goodness(p, this_cpu, prev->active_mm);
if (weight > c)
c = weight, next = p;
}
}
}Last updated