mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH] sched: fix load_above_capacity underflow
@ 2013-06-18  6:26 Lei Wen
  0 siblings, 0 replies; only message in thread
From: Lei Wen @ 2013-06-18  6:26 UTC (permalink / raw)
  To: Peter Zijlstra, Ingo Molnar, mingo, leiwen, linux-kernel

Apparently we don't want to see sds->busiest_nr_running is small than
sds->busiest_group_capacity, while our load_above_capacity is
an "unsigned long" type.

Signed-off-by: Lei Wen <leiwen@marvell.com>
---
 kernel/sched/fair.c |   13 +++++++++----
 1 file changed, 9 insertions(+), 4 deletions(-)

diff --git a/kernel/sched/fair.c b/kernel/sched/fair.c
index c61a614..fd90b17 100644
--- a/kernel/sched/fair.c
+++ b/kernel/sched/fair.c
@@ -4780,12 +4780,17 @@ static inline void calculate_imbalance(struct lb_env *env, struct sd_lb_stats *s
 		/*
 		 * Don't want to pull so many tasks that a group would go idle.
 		 */
-		load_above_capacity = (sds->busiest_nr_running -
-						sds->busiest_group_capacity);
+		if (sds->busiest_has_capacity)
+			load_above_capacity = 0;
+		else {
+			load_above_capacity = (sds->busiest_nr_running -
+					sds->busiest_group_capacity);
 
-		load_above_capacity *= (SCHED_LOAD_SCALE * SCHED_POWER_SCALE);
+			load_above_capacity *=
+				(SCHED_LOAD_SCALE * SCHED_POWER_SCALE);
 
-		load_above_capacity /= sds->busiest->sgp->power;
+			load_above_capacity /= sds->busiest->sgp->power;
+		}
 	}
 
 	/*
-- 
1.7.10.4


^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2013-06-18  6:26 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2013-06-18  6:26 [PATCH] sched: fix load_above_capacity underflow Lei Wen

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®