|
@@ -1546,28 +1546,12 @@ static bool load_too_imbalanced(long src_load, long dst_load,
|
|
|
src_capacity = env->src_stats.compute_capacity;
|
|
|
dst_capacity = env->dst_stats.compute_capacity;
|
|
|
|
|
|
- /* We care about the slope of the imbalance, not the direction. */
|
|
|
- if (dst_load < src_load)
|
|
|
- swap(dst_load, src_load);
|
|
|
-
|
|
|
- /* Is the difference below the threshold? */
|
|
|
- imb = dst_load * src_capacity * 100 -
|
|
|
- src_load * dst_capacity * env->imbalance_pct;
|
|
|
- if (imb <= 0)
|
|
|
- return false;
|
|
|
+ imb = abs(dst_load * src_capacity - src_load * dst_capacity);
|
|
|
|
|
|
- /*
|
|
|
- * The imbalance is above the allowed threshold.
|
|
|
- * Compare it with the old imbalance.
|
|
|
- */
|
|
|
orig_src_load = env->src_stats.load;
|
|
|
orig_dst_load = env->dst_stats.load;
|
|
|
|
|
|
- if (orig_dst_load < orig_src_load)
|
|
|
- swap(orig_dst_load, orig_src_load);
|
|
|
-
|
|
|
- old_imb = orig_dst_load * src_capacity * 100 -
|
|
|
- orig_src_load * dst_capacity * env->imbalance_pct;
|
|
|
+ old_imb = abs(orig_dst_load * src_capacity - orig_src_load * dst_capacity);
|
|
|
|
|
|
/* Would this change make things worse? */
|
|
|
return (imb > old_imb);
|