Linux kernel 为什么linux内核中完全公平调度程序的运行队列对于我的进程总是空的?
对于操作系统课程的作业,我需要修改Linux内核5.9的CFS调度程序。 我发现为了完成分配的目标,我需要修改调度器如何将进程添加到其运行队列(rbtree)中。这是在函数u_enqueue_entity()中完成的,该函数在其while循环中调用函数entity_before()Linux kernel 为什么linux内核中完全公平调度程序的运行队列对于我的进程总是空的?,linux-kernel,cfs,Linux Kernel,Cfs,对于操作系统课程的作业,我需要修改Linux内核5.9的CFS调度程序。 我发现为了完成分配的目标,我需要修改调度器如何将进程添加到其运行队列(rbtree)中。这是在函数u_enqueue_entity()中完成的,该函数在其while循环中调用函数entity_before() static void __enqueue_entity(struct cfs_rq *cfs_rq, struct sched_entity *se) { struct rb_node **link = &
static void __enqueue_entity(struct cfs_rq *cfs_rq, struct sched_entity *se)
{
struct rb_node **link = &cfs_rq->tasks_timeline.rb_root.rb_node;
struct rb_node *parent = NULL;
struct sched_entity *entry;
bool leftmost = true;
/*
* Find the right place in the rbtree:
*/
while (*link) {
parent = *link;
entry = rb_entry(parent, struct sched_entity, run_node);
/*
* We dont care about collisions. Nodes with
* the same key stay together.
*/
if (entity_before(se, entry)) {
link = &parent->rb_left;
} else {
link = &parent->rb_right;
leftmost = false;
}
}
if(se->rt_timeslice>0){
printk(KERN_ERR"inside enqueue_entity below the while loop");
}
rb_link_node(&se->run_node, parent, link);
rb_insert_color_cached(&se->run_node,
&cfs_rq->tasks_timeline, leftmost);
}
问题是,当我的进程在此调度程序中时,while循环从未运行。我对调度程序例程中的所有函数都使用了一组printk()来跟踪我的进程,显然它到达了_enqueue_entity()函数,但是每当函数为我的进程运行时,while循环就不会运行,我不明白为什么会发生这种情况