免费注册 查看新帖 |

Chinaunix

  平台 论坛 博客 文库
最近访问板块 发新帖
查看: 2426 | 回复: 2
打印 上一主题 下一主题

关于调度域平衡进程运行队列的算法疑问! [复制链接]

论坛徽章:
0
跳转到指定楼层
1 [收藏(0)] [报告]
发表于 2006-11-07 13:57 |只看该作者 |倒序浏览
/*
         * Check for affine wakeup and passive balancing possibilities.
         */
        if (this_sd) {
                int idx = this_sd->wake_idx;
                unsigned int imbalance;

                imbalance = 100 + (this_sd->imbalance_pct - 100) / 2;

                load = source_load(cpu, idx);
                this_load = target_load(this_cpu, idx);

                new_cpu = this_cpu; /* Wake to this CPU if we can */

                if (this_sd->flags & SD_WAKE_AFFINE) {
                        unsigned long tl = this_load;
                        /*
                         * If sync wakeup then subtract the (maximum possible)
                         * effect of the currently running task from the load
                         * of the current CPU:
                         */
                        if (sync)
                                tl -= SCHED_LOAD_SCALE;

                        if ((tl <= load &&
                                tl + target_load(cpu, idx) <= SCHED_LOAD_SCALE) ||
                                100*(tl + SCHED_LOAD_SCALE) <= imbalance*load) {
                                /*
                                 * This domain has SD_WAKE_AFFINE and
                                 * p is cache cold in this domain, and
                                 * there is no bad imbalance.
                                 */
                                schedstat_inc(this_sd, ttwu_move_affine);
                                goto out_set_cpu;
                        }
                }

                /*
                 * Start passive balancing when half the imbalance_pct
                 * limit is reached.
                 */
                if (this_sd->flags & SD_WAKE_BALANCE) {
                        if (imbalance*this_load <= 100*load) {
                                schedstat_inc(this_sd, ttwu_move_balance);
                                goto out_set_cpu;
                        }
                }
        }


嗨,各位DX,上面是
try_to_wake_up
的一段代码,上面的代码本身我并没有什么问题,问题出在这段代码使用的调度域平衡算法.比如
imbalance = 100 + (this_sd->imbalance_pct - 100) / 2;
这里这样做是如何考虑的.虽然代码作者有注释,但是我还是不明白它的调度原理所在.那位DX能结合这段代码给一个解释.或者告诉小弟哪里有相关资料也行,谢谢了!

论坛徽章:
0
2 [报告]
发表于 2006-11-08 13:48 |只看该作者

CU的大侠都到哪去了?

问题不算太烂吼,查了下mailist,这段代码可是大师们百般锤炼的部分,可惜就是没有讲到入门级的,CU的各位没有人了解吗?!
还没得到答案,顶!是不是还是搞linux应用的人多,很少人注意源码啊!

[ 本帖最后由 fineamy 于 2006-11-8 13:51 编辑 ]

论坛徽章:
16
2015亚冠之吉达阿赫利
日期:2015-08-17 11:21:462015年迎新春徽章
日期:2015-03-04 09:58:11酉鸡
日期:2014-12-07 09:06:19水瓶座
日期:2014-11-04 14:23:29天秤座
日期:2014-03-02 08:57:52双鱼座
日期:2014-02-22 13:07:56午马
日期:2014-02-14 11:08:18双鱼座
日期:2014-02-13 11:09:37卯兔
日期:2014-02-06 15:10:34子鼠
日期:2014-01-20 14:48:19戌狗
日期:2013-12-19 09:37:46射手座
日期:2013-12-19 09:33:47
3 [报告]
发表于 2011-12-07 18:03 |只看该作者
本帖最后由 embeddedlwp 于 2011-12-08 07:44 编辑

同问!
您需要登录后才可以回帖 登录 | 注册

本版积分规则 发表回复

  

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

清除 Cookies - ChinaUnix - Archiver - WAP - TOP