The Linux Kernel Mailing List
 help / color / mirror / Atom feed
From: jun.zhang@intel.com
To: mingo@redhat.com, peterz@infradead.org
Cc: linux-kernel@vger.kernel.org, stable@vger.kernel.org,
	zhang jun <jun.zhang@intel.com>,
	Chuansheng Liu <chuansheng.liu@intel.com>,
	Changcheng Liu <changcheng.liu@intel.com>,
	Hillf Danton <hillf.zj@alibaba-inc.com>,
	Vincent Guittot <vincent.guittot@linaro.org>
Subject: [PATCH] sched/fair: fix find_idlest_cpu return -1
Date: Fri,  5 Dec 2014 13:58:01 +0800	[thread overview]
Message-ID: <1417759082-28385-1-git-send-email-jun.zhang@intel.com> (raw)

From: zhang jun <jun.zhang@intel.com>

find_idlest_cpu return -1 is not reasonable, set default value to this_cpu.

Signed-off-by: zhang jun <jun.zhang@intel.com>
Signed-off-by: Chuansheng Liu <chuansheng.liu@intel.com>
Signed-off-by: Changcheng Liu <changcheng.liu@intel.com>
Cc: Hillf Danton <hillf.zj@alibaba-inc.com>
Cc: Vincent Guittot <vincent.guittot@linaro.org>
Cc: <stable@vger.kernel.org> # 3.14.25
---
 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 9b4c4f3..9d18887 100644
--- a/kernel/sched/fair.c
+++ b/kernel/sched/fair.c
@@ -4151,7 +4151,7 @@ static int
 find_idlest_cpu(struct sched_group *group, struct task_struct *p, int this_cpu)
 {
 	unsigned long load, min_load = ULONG_MAX;
-	int idlest = -1;
+	int idlest = this_cpu;
 	int i;
 
 	/* Traverse only the allowed CPUs */
@@ -4284,7 +4284,7 @@ select_task_rq_fair(struct task_struct *p, int prev_cpu, int sd_flag, int wake_f
 		}
 
 		new_cpu = find_idlest_cpu(group, p, cpu);
-		if (new_cpu == -1 || new_cpu == cpu) {
+		if (new_cpu == cpu) {
 			/* Now try balancing at a lower domain level of cpu */
 			sd = sd->child;
 			continue;
-- 
1.7.9.5


             reply	other threads:[~2014-12-05  6:22 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-12-05  5:58 jun.zhang [this message]
2014-12-05  6:38 ` [PATCH] sched/fair: fix find_idlest_cpu return -1 Hillf Danton
2014-12-15 16:59 ` Peter Zijlstra

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=1417759082-28385-1-git-send-email-jun.zhang@intel.com \
    --to=jun.zhang@intel.com \
    --cc=changcheng.liu@intel.com \
    --cc=chuansheng.liu@intel.com \
    --cc=hillf.zj@alibaba-inc.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mingo@redhat.com \
    --cc=peterz@infradead.org \
    --cc=stable@vger.kernel.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