码迷,mamicode.com
首页 > 其他好文 > 详细

kernel解读之 pick_next_rt_entity

时间:2014-11-02 10:46:22      阅读:177      评论:0      收藏:0      [点我收藏+]

标签:style   http   io   ar   sp   on   cti   bs   amp   

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;

1334 int 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 }








 

kernel解读之 pick_next_rt_entity

标签:style   http   io   ar   sp   on   cti   bs   amp   

原文地址:http://www.cnblogs.com/airwindow/p/4068390.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!