From: Lei Wen <leiwen@marvell.com>
To: Peter Zijlstra <peterz@infradead.org>,
Ingo Molnar <mingo@elte.hu>, <mingo@redhat.com>,
<leiwen@marvell.com>, <linux-kernel@vger.kernel.org>
Subject: [PATCH v4 4/4] sched: adjust fix_small_imbalance moving task condition
Date: Tue, 18 Jun 2013 21:04:19 +0800 [thread overview]
Message-ID: <1371560659-4686-5-git-send-email-leiwen@marvell.com> (raw)
In-Reply-To: <1371560659-4686-1-git-send-email-leiwen@marvell.com>
Suppose here we have such example, in current domain, there are two
cpus. CPU A with 4 task, while CPU B with 5 tasks. All tasks over two
runqueue are the same priority.
Let say the load for CPU A is 4096, and CPU B is 5120, then avg_load
should be 4608. Suppose sgp->power == SCHED_POWER_SCALE.
Then the imbalance value should be 512, less then the
busiest_load_per_task, which is 1024. From the logic we enter into
fix_small_imbalance adjustment.
For busiest_per_task==this_load_per_task, imbn's value is equal to 2.
Thus below statement would be true, and load balance would move one task
from CPU B to CPU A.
if (sds->max_load - sds->this_load + scaled_busy_load_per_task >=
(scaled_busy_load_per_task * imbn)) {
When CPU B issue load balance later, it would move one task back again,
which bring infinite end...
Kill the >=, and make it as >, to stop this loop.
Signed-off-by: Lei Wen <leiwen@marvell.com>
---
kernel/sched/fair.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/kernel/sched/fair.c b/kernel/sched/fair.c
index c478022..3be7844 100644
--- a/kernel/sched/fair.c
+++ b/kernel/sched/fair.c
@@ -4717,7 +4717,7 @@ void fix_small_imbalance(struct lb_env *env, struct sd_lb_stats *sds,
<< SCHED_POWER_SHIFT;
scaled_this_load_per_task /= sds->this->sgp->power;
- if (sds->max_load - sds->this_load + scaled_busy_load_per_task >=
+ if (sds->max_load - sds->this_load + scaled_busy_load_per_task >
(scaled_busy_load_per_task * imbn)) {
env->imbalance = sds->busiest_load_per_task;
return;
--
1.7.10.4
prev parent reply other threads:[~2013-06-18 13:07 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-06-18 13:04 [PATCH v4 0/4] small fix for scale usage Lei Wen
2013-06-18 13:04 ` [PATCH v4 1/4] sched: reduce calculation effort in fix_small_imbalance Lei Wen
2013-06-18 13:04 ` [PATCH v4 2/4] sched: scale the busy and this queue's per-task load before compare Lei Wen
2013-06-18 13:04 ` [PATCH v4 3/4] sched: scale cpu load for judgment of group imbalance Lei Wen
2013-06-18 13:04 ` Lei Wen [this message]
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=1371560659-4686-5-git-send-email-leiwen@marvell.com \
--to=leiwen@marvell.com \
--cc=linux-kernel@vger.kernel.org \
--cc=mingo@elte.hu \
--cc=mingo@redhat.com \
--cc=peterz@infradead.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®