public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH] sched/fair: Fix negative imbalance in imbalance calculation
@ 2020-03-26  5:42 Aubrey Li
  2020-03-26 13:30 ` Phil Auld
                   ` (3 more replies)
  0 siblings, 4 replies; 6+ messages in thread
From: Aubrey Li @ 2020-03-26  5:42 UTC (permalink / raw)
  To: vincent.guittot, mingo, peterz, juri.lelli, dietmar.eggemann,
	rostedt, bsegall, mgorman, linux-kernel
  Cc: tim.c.chen, vpillai, joel, Aubrey Li, Aubrey Li, Phil Auld

A negative imbalance value was observed after imbalance calculation,
this happens when the local sched group type is group_fully_busy,
and the average load of local group is greater than the selected
busiest group. Fix this problem by comparing the average load of the
local and busiest group before imbalance calculation formula.

Suggested-by: Vincent Guittot <vincent.guittot@linaro.org>
Signed-off-by: Aubrey Li <aubrey.li@linux.intel.com>
Cc: Phil Auld <pauld@redhat.com>
---
 kernel/sched/fair.c | 8 ++++++++
 1 file changed, 8 insertions(+)

diff --git a/kernel/sched/fair.c b/kernel/sched/fair.c
index c1217bf..4a2ba3f 100644
--- a/kernel/sched/fair.c
+++ b/kernel/sched/fair.c
@@ -8761,6 +8761,14 @@ static inline void calculate_imbalance(struct lb_env *env, struct sd_lb_stats *s
 
 		sds->avg_load = (sds->total_load * SCHED_CAPACITY_SCALE) /
 				sds->total_capacity;
+		/*
+		 * If the local group is more loaded than the selected
+		 * busiest group don't try to pull any tasks.
+		 */
+		if (local->avg_load >= busiest->avg_load) {
+			env->imbalance = 0;
+			return;
+		}
 	}
 
 	/*
-- 
2.7.4


^ permalink raw reply related	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2020-04-08 12:20 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2020-03-26  5:42 [PATCH] sched/fair: Fix negative imbalance in imbalance calculation Aubrey Li
2020-03-26 13:30 ` Phil Auld
2020-03-26 16:03 ` Vincent Guittot
2020-03-30 10:38   ` Peter Zijlstra
2020-03-27 11:48 ` Mel Gorman
2020-04-08 12:20 ` [tip: sched/urgent] " tip-bot2 for Aubrey Li

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