首页 > 其他 > 详细

kernel解读之 pick_next_rt_entity

时间:2014-11-02 10:43:38      阅读:220      评论:0      收藏:0      [点我收藏+]
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

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

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!