enqueue_task_rt
function in./kernel/sched/rt.c
负责将任务排入运行队列。enqueue_task_rt
包含调用enqueue_rt_entity
哪个调用dequeue_rt_stack
。大部分代码看起来合乎逻辑,但由于函数dequeue_rt_stack
无法理解它的作用,我有点迷茫。有人可以告诉我我缺少什么逻辑或建议一些好读的东西。
编辑:以下是dequeue_rt_stack
函数的代码
struct sched_rt_entity *back = NULL;
/* macro for_each_sched_rt_entity defined as
for(; rt_se; rt_se = rt_se->parent)*/
for_each_sched_rt_entity(rt_se) {
rt_se->back = back;
back = rt_se;
}
for (rt_se = back; rt_se; rt_se = rt_se->back) {
if (on_rt_rq(rt_se))
__dequeue_rt_entity(rt_se);
}
更具体地说,我不明白为什么需要这段代码:
for_each_sched_rt_entity(rt_se) {
rt_se->back = back;
back = rt_se;
}
它的相关性是什么。