[PATCH v4 4/4] sched: adjust fix_small_imbalance moving task condition

From: Lei Wen
Date: Tue Jun 18 2013 - 09:07:46 EST


Suppose here we have such example, in current domain, there are two
cpus. CPU A with 4 task, while CPU B with 5 tasks. All tasks over two
runqueue are the same priority.

Let say the load for CPU A is 4096, and CPU B is 5120, then avg_load
should be 4608. Suppose sgp->power == SCHED_POWER_SCALE.
Then the imbalance value should be 512, less then the
busiest_load_per_task, which is 1024. From the logic we enter into
fix_small_imbalance adjustment.

For busiest_per_task==this_load_per_task, imbn's value is equal to 2.
Thus below statement would be true, and load balance would move one task
from CPU B to CPU A.
if (sds->max_load - sds->this_load + scaled_busy_load_per_task >=
(scaled_busy_load_per_task * imbn)) {

When CPU B issue load balance later, it would move one task back again,
which bring infinite end...
Kill the >=, and make it as >, to stop this loop.

Signed-off-by: Lei Wen <leiwen@xxxxxxxxxxx>
---
kernel/sched/fair.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/kernel/sched/fair.c b/kernel/sched/fair.c
index c478022..3be7844 100644
--- a/kernel/sched/fair.c
+++ b/kernel/sched/fair.c
@@ -4717,7 +4717,7 @@ void fix_small_imbalance(struct lb_env *env, struct sd_lb_stats *sds,
<< SCHED_POWER_SHIFT;
scaled_this_load_per_task /= sds->this->sgp->power;

- if (sds->max_load - sds->this_load + scaled_busy_load_per_task >=
+ if (sds->max_load - sds->this_load + scaled_busy_load_per_task >
(scaled_busy_load_per_task * imbn)) {
env->imbalance = sds->busiest_load_per_task;
return;
--
1.7.10.4

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/