public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Miao Xie <miaox@cn.fujitsu.com>
To: Ingo Molnar <mingo@elte.hu>, Peter Zijlstra <a.p.zijlstra@chello.nl>
Cc: Linux-Kernel <linux-kernel@vger.kernel.org>
Subject: [PATCH] sched: fix off-by-one bug in balance_tasks()
Date: Wed, 15 Apr 2009 10:49:14 +0800	[thread overview]
Message-ID: <49E54B2A.9060100@cn.fujitsu.com> (raw)

If the load that need be moved equals the half weight of a task, I think
it is unnecessary to move this task. Or this task will be moved back and
forth.

Signed-off-by: Miao Xie <miaox@cn.fujitsu.com>
---
 kernel/sched.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/kernel/sched.c b/kernel/sched.c
index 5724508..44926c8 100644
--- a/kernel/sched.c
+++ b/kernel/sched.c
@@ -3085,7 +3085,7 @@ next:
 	if (!p || loops++ > sysctl_sched_nr_migrate)
 		goto out;
 
-	if ((p->se.load.weight >> 1) > rem_load_move ||
+	if ((p->se.load.weight >> 1) >= rem_load_move ||
 	    !can_migrate_task(p, busiest, this_cpu, sd, idle, &pinned)) {
 		p = iterator->next(iterator->arg);
 		goto next;
-- 
1.6.0.3



             reply	other threads:[~2009-04-15  2:53 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-04-15  2:49 Miao Xie [this message]
2009-04-15 11:41 ` [PATCH] sched: fix off-by-one bug in balance_tasks() Peter Zijlstra
2009-04-16  1:23   ` Miao Xie

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=49E54B2A.9060100@cn.fujitsu.com \
    --to=miaox@cn.fujitsu.com \
    --cc=a.p.zijlstra@chello.nl \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mingo@elte.hu \
    /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