Skip to contentSkip to conversation

sched/fair: Fix unsetting of "has_idle_cores" flag

PATCH Superseded Gautham R. Shenoy 3 participants 4 messages Apr 26, 2021 – May 10, 2021 Scheduler

v1 of 2 Superseded Latest is v2 →

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 sched/fair: Fix unsetting of "has_idle_cores" flag

From: "Gautham R. Shenoy" <[email protected]>

In commit 9fe1f127b913 ("sched/fair: Merge select_idle_core/cpu()"), in select_idle_cpu(), we check if an idle core is present in the LLC of the target CPU via the flag "has_idle_cores". We look for the idle core in select_idle_cores(). If select_idle_cores() isn't able to find an idle core/CPU, we need to unset the has_idle_cores flag in the LLC of the target to prevent other CPUs from going down this route.

However, the current code is unsetting it in the LLC of the current CPU instead of the target CPU. This patch fixes this issue.

Fixes Commit 9fe1f127b913 ("sched/fair: Merge select_idle_core/cpu()")
Cc Mel Gorman <[email protected]>
---
 kernel/sched/fair.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
kernel/sched/fair.c +1 -1
index 794c2cb..5fb5020 100644
@@ -6171,7 +6171,7 @@ static int select_idle_cpu(struct task_struct *p, struct sched_domain *sd, int t
 	}
 
 	if (smt)
-		set_idle_cores(this, false);
+		set_idle_cores(target, false);
 
 	if (sched_feat(SIS_PROP) && !smt) {
 		time = cpu_clock(this) - time;
Signature · 1 line
1.9.4
maintainer Reviewed-by on v1 1/1
#1 lore raw
Quoted 10 lines · Gautham R. Shenoy

From: "Gautham R. Shenoy" <[email protected]>

In commit 9fe1f127b913 ("sched/fair: Merge select_idle_core/cpu()"), in select_idle_cpu(), we check if an idle core is present in the LLC of the target CPU via the flag "has_idle_cores". We look for the idle core in select_idle_cores(). If select_idle_cores() isn't able to find an idle core/CPU, we need to unset the has_idle_cores flag in the LLC of the target to prevent other CPUs from going down this route.

Quoted 6 lines

However, the current code is unsetting it in the LLC of the current CPU instead of the target CPU. This patch fixes this issue.

Fixes Commit 9fe1f127b913 ("sched/fair: Merge select_idle_core/cpu()")
Cc Mel Gorman <[email protected]>
Quoted 20 lines
---
 kernel/sched/fair.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
kernel/sched/fair.c +1 -2
index 794c2cb..5fb5020 100644
@@ -6171,7 +6171,7 @@ static int select_idle_cpu(struct task_struct *p, struct sched_domain *sd, int t
        }
 
        if (smt)
-               set_idle_cores(this, false);
+               set_idle_cores(target, false);
 
        if (sched_feat(SIS_PROP) && !smt) {
                time = cpu_clock(this) - time;
--

1.9.4

Acked-by on v1 1/1
#2 lore raw
In reply to Gautham R. Shenoy
Quoted 9 lines · Gautham R. Shenoy

From: "Gautham R. Shenoy" <[email protected]>

In commit 9fe1f127b913 ("sched/fair: Merge select_idle_core/cpu()"), in select_idle_cpu(), we check if an idle core is present in the LLC of the target CPU via the flag "has_idle_cores". We look for the idle core in select_idle_cores(). If select_idle_cores() isn't able to find an idle core/CPU, we need to unset the has_idle_cores flag in the LLC of the target to prevent other CPUs from going down this route.

Quoted 6 lines

However, the current code is unsetting it in the LLC of the current CPU instead of the target CPU. This patch fixes this issue.

Fixes Commit 9fe1f127b913 ("sched/fair: Merge select_idle_core/cpu()")
Cc Mel Gorman <[email protected]>
Signature · 2 lines
Mel Gorman
SUSE Labs
#3 lore raw
In reply to Gautham R. Shenoy

Peter, Ingo,

Pinging to check on this tiny fix :-)

Quoted 35 lines · Gautham R. Shenoy

From: "Gautham R. Shenoy" <[email protected]>

In commit 9fe1f127b913 ("sched/fair: Merge select_idle_core/cpu()"), in select_idle_cpu(), we check if an idle core is present in the LLC of the target CPU via the flag "has_idle_cores". We look for the idle core in select_idle_cores(). If select_idle_cores() isn't able to find an idle core/CPU, we need to unset the has_idle_cores flag in the LLC of the target to prevent other CPUs from going down this route.

However, the current code is unsetting it in the LLC of the current CPU instead of the target CPU. This patch fixes this issue.

Fixes Commit 9fe1f127b913 ("sched/fair: Merge select_idle_core/cpu()")
Cc Mel Gorman <[email protected]>
---
 kernel/sched/fair.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
kernel/sched/fair.c +1 -1
index 794c2cb..5fb5020 100644
@@ -6171,7 +6171,7 @@ static int select_idle_cpu(struct task_struct *p, struct sched_domain *sd, int t
 	}
 
 	if (smt)
-		set_idle_cores(this, false);
+		set_idle_cores(target, false);
 
 	if (sched_feat(SIS_PROP) && !smt) {
 		time = cpu_clock(this) - time;
Signature · 1 line
1.9.4