免费注册 查看新帖 |

Chinaunix

  平台 论坛 博客 文库
12
最近访问板块 发新帖
楼主: donghaitad

[进程管理] 请教CFS调度器问题(续) [复制链接]

论坛徽章:
0
发表于 2013-11-04 21:00 |显示全部楼层
本帖最后由 donghaitad 于 2013-11-04 21:06 编辑

我去掉了printk, 但在单CPU模式下还是有问题。

系统卡住不动了,好像死锁了。

试了很多次,多CPU环境下好像没问题。

论坛徽章:
1
双鱼座
日期:2013-08-28 13:47:26
发表于 2013-11-08 11:08 |显示全部楼层
Maybe you can try this:

Before "pick_next_entity" declare the dequeue_task_fair:

static void dequeue_task_fair(struct rq *rq, struct task_struct *p, int sleep);

Modify the pick_next_entity like this:

static struct sched_entity *pick_next_entity(struct cfs_rq *cfs_rq)
{
        struct sched_entity *se = NULL;
        struct task_struct *tp;
       
        if (first_fair(cfs_rq)) {
                se = __pick_next_entity(cfs_rq);
                if(!(se->my_q)){
                        tp = task_of(se);
                        if((tp->pid == target_pid)){
                                dequeue_task_fair(rq_of(cfs_rq),tp,1);
                                rq_of(cfs_rq)->nr_running--;
                                update_load_sub(&rq_of(cfs_rq)->load,se->load.weight);
                                if (first_fair(cfs_rq)){
                                        se = __pick_next_entity(cfs_rq);
                                        tp=task_of(se);
                                        set_next_entity(cfs_rq, se);
                                }       
                                else{
                                        se = NULL;
                                }
                        }
                        else{
                                set_next_entity(cfs_rq, se);
                        }
                }
                else{
                        set_next_entity(cfs_rq, se);
                       
                }
        }

        return se;
}

Modify pick_next_task_fair as you've done.

论坛徽章:
0
发表于 2013-11-17 19:07 |显示全部楼层
果然在单CPU环境下也没有问题了,firkraag能帮忙解释一下:
rq_of(cfs_rq)->nr_running--;
update_load_sub(&rq_of(cfs_rq)->load,se->load.weight);
为什么是必须的?

论坛徽章:
1
双鱼座
日期:2013-08-28 13:47:26
发表于 2013-11-18 09:06 |显示全部楼层
They are not necessary for your requirement.

论坛徽章:
0
发表于 2013-11-20 21:15 |显示全部楼层
再请教firkraag一个问题:

se->my_q代表调度实体下的就绪队列吧?

Thanks so much!

论坛徽章:
1
双鱼座
日期:2013-08-28 13:47:26
发表于 2013-11-21 09:02 |显示全部楼层
Yes, it is.
您需要登录后才可以回帖 登录 | 注册

本版积分规则 发表回复

  

北京盛拓优讯信息技术有限公司. 版权所有 京ICP备16024965号-6 北京市公安局海淀分局网监中心备案编号:11010802020122 niuxiaotong@pcpop.com 17352615567
未成年举报专区
中国互联网协会会员  联系我们:huangweiwei@itpub.net
感谢所有关心和支持过ChinaUnix的朋友们 转载本站内容请注明原作者名及出处

清除 Cookies - ChinaUnix - Archiver - WAP - TOP