Skip to contentSkip to conversation

sched/fair: fix find_idlest_cpu return -1

PATCH In review [email protected] 3 participants 3 messages Dec 5, 2014 – Dec 15, 2014

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 sched/fair: fix find_idlest_cpu return -1

From: zhang jun <[email protected]>

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

---
 kernel/sched/fair.c |    4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
kernel/sched/fair.c +2 -2
index 9b4c4f3..9d18887 100644
@@ -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;
Signature · 1 line
1.7.9.5
#1 lore raw
Quoted 39 lines

From: zhang jun <[email protected]>

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

---
 kernel/sched/fair.c |    4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
kernel/sched/fair.c +2 -3
index 9b4c4f3..9d18887 100644
@@ -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

maintainer
#2 lore raw
In reply to [email protected]
Quoted 3 lines · On Fri, Dec 05, 2014 at 01:58:01PM +0800, [email protected] wrote:

From: zhang jun <[email protected]>

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

This fails to explain why.

Quoted 3 lines

This is an invalid SoB chain.

Quoted 3 lines
Cc Hillf Danton <[email protected]>
Cc Vincent Guittot <[email protected]>
Cc <[email protected]> # 3.14.25