1328 static struct sched_rt_entity *pick_next_rt_entity(struct rq *rq,
1329                                                    struct rt_rq *rt_rq)
1330 {
1331         struct rt_prio_array *array = &rt_rq->active;
       //取出rt_rq的priority数组,一个runqueue数组,每个优先级别有一个。
       //struct rt_prio_array active;
       //struct list_head queue[MAX_RT_PRIO]

1332 struct sched_rt_entity *next = NULL;1333
        struct list_head *queue;

idx;
1335 
1336         idx = sched_find_first_bit(array->bitmap);
        //sched_find_first_bit()寻找第一个非0位
1337 BUG_ON(idx >= MAX_RT_PRIO);
        //如果idx大于MAX_RT_PRIO, rasie error 1338 1339 queue = array->queue + idx;
        //非常漂亮的用法,直接取queue[idx]中的queue(list_head)
1340 next = list_entry(queue->next, struct sched_rt_entity, run_list);
        //取queue的队首元素next,注意queue是dummy head,取出sched_rt_entity.

1341 1342 return next; 1343 }








 

相关文章:

  • 2021-12-06
  • 2022-12-23
  • 2021-10-26
  • 2021-10-15
  • 2022-12-23
  • 2021-07-28
  • 2021-11-23
  • 2022-12-23
猜你喜欢
  • 2021-12-20
  • 2022-12-23
  • 2021-08-17
  • 2022-12-23
  • 2021-08-09
  • 2022-12-23
  • 2022-12-23
相关资源
相似解决方案