难倒中国linux高手的一个问题!
/*
* 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能结合这段代码给一个解释.或者告诉小弟哪里有相关资料也行,谢谢了! :x 连你这个linux高手都被难倒了,还发到这里干什么? 得罪了,赫赫,贴子挂了好长时间得不到答案,耐何俺又禁不住这种求知的欲望,所以标题权是吸引眼球,解决问题才是关键,望各位不要介意!
说明一下,俺算不上linux菜鸟,更不是linux高手,只是跟众多linux的爱好者一样,不过希望通过努力能够成为一名linux菜鸟。 还是将问题具体些:请教dx:
100代表何意,
this_sd->imbalance_pct
作何解释?
imbalance*this_load <= 100*load
为何如此作?
页:
[1]