All of lore.kernel.org
 help / color / mirror / Atom feed
From: Vincent Guittot <vincent.guittot@linaro.org>
To: 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: valentin.schneider@arm.com, Vincent Guittot <vincent.guittot@linaro.org>
Subject: [PATCH 1/4] sched/fair: relax constraint on task's load during load balance
Date: Mon, 14 Sep 2020 12:03:37 +0200	[thread overview]
Message-ID: <20200914100340.17608-2-vincent.guittot@linaro.org> (raw)
In-Reply-To: <20200914100340.17608-1-vincent.guittot@linaro.org>

Some UCs like 9 always running tasks on 8 CPUs can't be balanced and the
load balancer currently migrates the waiting task between the CPUs in an
almost random manner. The success of a rq pulling a task depends of the
value of nr_balance_failed of its domains and its ability to be faster
than others to detach it. This behavior results in an unfair distribution
of the running time between tasks because some CPUs will run most of the
time, if not always, the same task whereas others will share their time
between several tasks.

Instead of using nr_balance_failed as a boolean to relax the condition
for detaching task, the LB will use nr_balanced_failed to relax the
threshold between the tasks'load and the imbalance. This mecanism
prevents the same rq or domain to always win the load balance fight.

Signed-off-by: Vincent Guittot <vincent.guittot@linaro.org>
---
 kernel/sched/fair.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/kernel/sched/fair.c b/kernel/sched/fair.c
index 2ba8f230feb9..765be8273292 100644
--- a/kernel/sched/fair.c
+++ b/kernel/sched/fair.c
@@ -7669,8 +7669,8 @@ static int detach_tasks(struct lb_env *env)
 			 * scheduler fails to find a good waiting task to
 			 * migrate.
 			 */
-			if (load/2 > env->imbalance &&
-			    env->sd->nr_balance_failed <= env->sd->cache_nice_tries)
+
+			if ((load >> env->sd->nr_balance_failed) > env->imbalance)
 				goto next;
 
 			env->imbalance -= load;
-- 
2.17.1


  reply	other threads:[~2020-09-14 10:04 UTC|newest]

Thread overview: 26+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-09-14 10:03 [PATCH 0/4] sched/fair: Improve fairness between cfs tasks Vincent Guittot
2020-09-14 10:03 ` Vincent Guittot [this message]
2020-09-14 10:03 ` [PATCH 2/4] sched/fair: reduce minimal imbalance threshold Vincent Guittot
2020-09-15 19:04   ` Valentin Schneider
2020-09-16  6:53     ` Vincent Guittot
2020-09-16  8:33       ` Valentin Schneider
2020-09-14 10:03 ` [PATCH 3/4] sched/fair: minimize concurrent LBs between domain level Vincent Guittot
2020-09-15 19:04   ` Valentin Schneider
2020-09-16  6:54     ` Vincent Guittot
2020-09-14 10:03 ` [PATCH 4/4] sched/fair: reduce busy load balance interval Vincent Guittot
2020-09-15  9:11   ` Jiang Biao
2020-09-15  9:28     ` Vincent Guittot
2020-09-15 11:36       ` Jiang Biao
2020-09-15 12:42         ` Vincent Guittot
2020-09-16  1:14           ` Jiang Biao
2020-09-15 19:04   ` Valentin Schneider
2020-09-16  7:02     ` Vincent Guittot
2020-09-16  8:34       ` Valentin Schneider
2020-09-14 11:42 ` [PATCH 0/4] sched/fair: Improve fairness between cfs tasks peterz
2020-09-14 12:53   ` Phil Auld
2020-09-14 16:03     ` Vincent Guittot
2020-09-14 15:50   ` Mel Gorman
2020-09-14 16:04     ` Vincent Guittot
2020-09-18 16:39   ` Phil Auld
2020-09-18 17:27     ` Phil Auld
2020-09-15 19:05 ` Valentin Schneider

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=20200914100340.17608-2-vincent.guittot@linaro.org \
    --to=vincent.guittot@linaro.org \
    --cc=bsegall@google.com \
    --cc=dietmar.eggemann@arm.com \
    --cc=juri.lelli@redhat.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mgorman@suse.de \
    --cc=mingo@redhat.com \
    --cc=peterz@infradead.org \
    --cc=rostedt@goodmis.org \
    --cc=valentin.schneider@arm.com \
    /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
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.