linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Aubrey Li <aubrey.li@intel.com>
To: vincent.guittot@linaro.org, mingo@redhat.com,
	peterz@infradead.org, juri.lelli@redhat.com,
	dietmar.eggemann@arm.com, rostedt@goodmis.org,
	bsegall@google.com, mgorman@suse.de,
	linux-kernel@vger.kernel.org
Cc: tim.c.chen@linux.intel.com, vpillai@digitalocean.com,
	joel@joelfernandes.org, Aubrey Li <aubrey.li@intel.com>,
	Aubrey Li <aubrey.li@linux.intel.com>,
	Phil Auld <pauld@redhat.com>
Subject: [PATCH] sched/fair: Fix negative imbalance in imbalance calculation
Date: Thu, 26 Mar 2020 13:42:29 +0800	[thread overview]
Message-ID: <1585201349-70192-1-git-send-email-aubrey.li@intel.com> (raw)

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


             reply	other threads:[~2020-03-26  5:53 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-03-26  5:42 Aubrey Li [this message]
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

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1585201349-70192-1-git-send-email-aubrey.li@intel.com \
    --to=aubrey.li@intel.com \
    --cc=aubrey.li@linux.intel.com \
    --cc=bsegall@google.com \
    --cc=dietmar.eggemann@arm.com \
    --cc=joel@joelfernandes.org \
    --cc=juri.lelli@redhat.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mgorman@suse.de \
    --cc=mingo@redhat.com \
    --cc=pauld@redhat.com \
    --cc=peterz@infradead.org \
    --cc=rostedt@goodmis.org \
    --cc=tim.c.chen@linux.intel.com \
    --cc=vincent.guittot@linaro.org \
    --cc=vpillai@digitalocean.com \
    --subject='Re: [PATCH] sched/fair: Fix negative imbalance in imbalance calculation' \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).