LinuxSir.cn,穿越时空的Linuxsir!

 找回密码
 注册
搜索
热搜: shell linux mysql
查看: 566|回复: 0

高手指点

[复制链接]
发表于 2012-1-19 13:16:11 | 显示全部楼层 |阅读模式
在schedule中pick_next_entity代码如下:

static struct sched_entity *pick_next_entity(struct cfs_rq *cfs_rq)
{
  struct sched_entity *se = __pick_next_entity(cfs_rq);
  if (cfs_rq->next && wakeup_preempt_entity(cfs_rq->next, se) < 1)
  return cfs_rq->next;
  if (cfs_rq->last && wakeup_preempt_entity(cfs_rq->last, se) < 1)
  return cfs_rq->last;
  return se;
}
其实这个函数就是在cfs_rq->rb_leftmost ;cfs_rq->next;cfs_rq->last 中选择一个虚拟时间最小的运行,对不对?
其中cfs_rq->next;cfs_rq->last这两个是在try_to_wake_up唤醒的时候赋值的,
我的问题是
在try_to_wake_up中cfs_rq->next 对应的进程不是已经更新过虚拟时间并且被插入到rbtree了吗?那cfs_rq->rb_leftmost
自然会指向最小虚拟时间的那个进程啊!!!
调度的时候,在上面代码中又来做一次判断 ,有意义吗。。。。?

难道在调用上面这个函数的时候 cfs_rq->next;cfs_rq->last的虚拟时间会比cfs_rq->rb_leftmost的还小?????
您需要登录后才可以回帖 登录 | 注册

本版积分规则

快速回复 返回顶部 返回列表