mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: zgpeng <zgpeng.linux@gmail.com>
To: mingo@redhat.com, peterz@infradead.org, juri.lelli@redhat.com,
	vincent.guittot@linaro.org, dietmar.eggemann@arm.com,
	rostedt@goodmis.org, bsegall@google.com, mgorman@suse.de,
	bristot@redhat.com, linux-kernel@vger.kernel.org
Subject: [PATCH] sched/fair: Simplify the scene where both local and busiest are group_fully_busy
Date: Wed,  6 Apr 2022 19:46:20 +0800	[thread overview]
Message-ID: <1649245580-27256-1-git-send-email-zgpeng@tencent.com> (raw)

When both local and busiest group are group_fully_busy type, because
the avg_load of the group of type group_fully_busy is not calculated, the
avg_load value is equal to 0. In this case, load balancing will not actually 
done, because after a series of calculations in the calculate_imbalance, it 
will be considered that load balance is not required. Therefore,it is not
necessary to enter calculate_imbalance to do some useless work.

Signed-off-by: zgpeng <zgpeng@tencent.com>
Reviewed-by: Samuel Liao <samuelliao@tencent.com>
---
 kernel/sched/fair.c | 12 ++++++++++++
 1 file changed, 12 insertions(+)

diff --git a/kernel/sched/fair.c b/kernel/sched/fair.c
index 9f75303..cc1d6c4 100644
--- a/kernel/sched/fair.c
+++ b/kernel/sched/fair.c
@@ -9634,6 +9634,18 @@ static struct sched_group *find_busiest_group(struct lb_env *env)
 			 * busiest doesn't have any tasks waiting to run
 			 */
 			goto out_balanced;
+
+		if (local->group_type == group_fully_busy)
+			/*
+			 * If local group is group_fully_busy, the code goes here,
+			 * the type of busiest group must also be group_fully_busy.
+			 * Because the avg_load of the group_fully_busy type is not
+			 * calculated at present, it is actually equal to 0. In this
+			 * scenario, load balance is not performed. therefore, it can
+			 * be returned directly here, and there is no need to do some
+			 * useless work in calculate_imbalance.
+			 */
+			goto out_balanced;
 	}
 
 force_balance:
-- 
2.9.5


             reply	other threads:[~2022-04-06 15:01 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-04-06 11:46 zgpeng [this message]
2022-04-06 15:41 ` Vincent Guittot
     [not found]   ` <CAE5vP3nYKKxfFWLG_idezXRiDALmGvN8EY0sL8vLK+5rnwMUaA@mail.gmail.com>
2022-04-08  7:39     ` Vincent Guittot

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=1649245580-27256-1-git-send-email-zgpeng@tencent.com \
    --to=zgpeng.linux@gmail.com \
    --cc=bristot@redhat.com \
    --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=vincent.guittot@linaro.org \
    /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 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®