linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH v2] sched/fair: Fix clearing of has_idle_cores flag
@ 2021-05-11 15:16 Gautham R. Shenoy
  2021-05-12  8:47 ` [tip: sched/urgent] sched/fair: Fix clearing of has_idle_cores flag in select_idle_cpu() tip-bot2 for Gautham R. Shenoy
  2021-05-12  9:30 ` [PATCH v2] sched/fair: Fix clearing of has_idle_cores flag Peter Zijlstra
  0 siblings, 2 replies; 3+ messages in thread
From: Gautham R. Shenoy @ 2021-05-11 15:16 UTC (permalink / raw)
  To: Mel Gorman, Peter Zijlstra, Ingo Molnar, Vincent Guittot,
	Srikar Dronamraju
  Cc: linux-kernel, Gautham R. Shenoy

From: "Gautham R. Shenoy" <ego@linux.vnet.ibm.com>

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()")
Acked-by: Mel Gorman <mgorman@techsingularity.net>
Reviewed-by: Vincent Guittot <vincent.guittot@linaro.org>
Reviewed-by: Srikar Dronamraju <srikar@linux.vnet.ibm.com>
Signed-off-by: Gautham R. Shenoy <ego@linux.vnet.ibm.com>
---
v1 --> v2 : Rebased against tip/sched/core

 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 1d75af1..6de1101 100644
--- a/kernel/sched/fair.c
+++ b/kernel/sched/fair.c
@@ -6217,7 +6217,7 @@ static int select_idle_cpu(struct task_struct *p, struct sched_domain *sd, bool
 	}
 
 	if (has_idle_core)
-		set_idle_cores(this, false);
+		set_idle_cores(target, false);
 
 	if (sched_feat(SIS_PROP) && !has_idle_core) {
 		time = cpu_clock(this) - time;
-- 
1.9.4


^ permalink raw reply related	[flat|nested] 3+ messages in thread

* [tip: sched/urgent] sched/fair: Fix clearing of has_idle_cores flag in select_idle_cpu()
  2021-05-11 15:16 [PATCH v2] sched/fair: Fix clearing of has_idle_cores flag Gautham R. Shenoy
@ 2021-05-12  8:47 ` tip-bot2 for Gautham R. Shenoy
  2021-05-12  9:30 ` [PATCH v2] sched/fair: Fix clearing of has_idle_cores flag Peter Zijlstra
  1 sibling, 0 replies; 3+ messages in thread
From: tip-bot2 for Gautham R. Shenoy @ 2021-05-12  8:47 UTC (permalink / raw)
  To: linux-tip-commits
  Cc: Gautham R. Shenoy, Ingo Molnar, Vincent Guittot,
	Srikar Dronamraju, Mel Gorman, x86, linux-kernel

The following commit has been merged into the sched/urgent branch of tip:

Commit-ID:     02dbb7246c5bbbbe1607ebdc546ba5c454a664b1
Gitweb:        https://git.kernel.org/tip/02dbb7246c5bbbbe1607ebdc546ba5c454a664b1
Author:        Gautham R. Shenoy <ego@linux.vnet.ibm.com>
AuthorDate:    Tue, 11 May 2021 20:46:09 +05:30
Committer:     Ingo Molnar <mingo@kernel.org>
CommitterDate: Wed, 12 May 2021 10:41:28 +02:00

sched/fair: Fix clearing of has_idle_cores flag in select_idle_cpu()

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: 9fe1f127b913 ("sched/fair: Merge select_idle_core/cpu()")
Signed-off-by: Gautham R. Shenoy <ego@linux.vnet.ibm.com>
Signed-off-by: Ingo Molnar <mingo@kernel.org>
Reviewed-by: Vincent Guittot <vincent.guittot@linaro.org>
Reviewed-by: Srikar Dronamraju <srikar@linux.vnet.ibm.com>
Acked-by: Mel Gorman <mgorman@techsingularity.net>
Link: https://lore.kernel.org/r/1620746169-13996-1-git-send-email-ego@linux.vnet.ibm.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 20aa234..3248e24 100644
--- a/kernel/sched/fair.c
+++ b/kernel/sched/fair.c
@@ -6217,7 +6217,7 @@ static int select_idle_cpu(struct task_struct *p, struct sched_domain *sd, bool 
 	}
 
 	if (has_idle_core)
-		set_idle_cores(this, false);
+		set_idle_cores(target, false);
 
 	if (sched_feat(SIS_PROP) && !has_idle_core) {
 		time = cpu_clock(this) - time;

^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH v2] sched/fair: Fix clearing of has_idle_cores flag
  2021-05-11 15:16 [PATCH v2] sched/fair: Fix clearing of has_idle_cores flag Gautham R. Shenoy
  2021-05-12  8:47 ` [tip: sched/urgent] sched/fair: Fix clearing of has_idle_cores flag in select_idle_cpu() tip-bot2 for Gautham R. Shenoy
@ 2021-05-12  9:30 ` Peter Zijlstra
  1 sibling, 0 replies; 3+ messages in thread
From: Peter Zijlstra @ 2021-05-12  9:30 UTC (permalink / raw)
  To: Gautham R. Shenoy
  Cc: Mel Gorman, Ingo Molnar, Vincent Guittot, Srikar Dronamraju,
	linux-kernel

On Tue, May 11, 2021 at 08:46:09PM +0530, Gautham R. Shenoy wrote:
> From: "Gautham R. Shenoy" <ego@linux.vnet.ibm.com>
> 
> 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()")
> Acked-by: Mel Gorman <mgorman@techsingularity.net>
> Reviewed-by: Vincent Guittot <vincent.guittot@linaro.org>
> Reviewed-by: Srikar Dronamraju <srikar@linux.vnet.ibm.com>
> Signed-off-by: Gautham R. Shenoy <ego@linux.vnet.ibm.com>

Thanks!

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2021-05-12  9:37 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-05-11 15:16 [PATCH v2] sched/fair: Fix clearing of has_idle_cores flag Gautham R. Shenoy
2021-05-12  8:47 ` [tip: sched/urgent] sched/fair: Fix clearing of has_idle_cores flag in select_idle_cpu() tip-bot2 for Gautham R. Shenoy
2021-05-12  9:30 ` [PATCH v2] sched/fair: Fix clearing of has_idle_cores flag Peter Zijlstra

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).