linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] sched/fair: Optimize select_idle_core
@ 2019-12-05 17:23 Srikar Dronamraju
  2019-12-05 17:27 ` Vincent Guittot
  2019-12-06 12:00 ` Valentin Schneider
  0 siblings, 2 replies; 12+ messages in thread
From: Srikar Dronamraju @ 2019-12-05 17:23 UTC (permalink / raw)
  To: Ingo Molnar, Peter Zijlstra
  Cc: LKML, Mel Gorman, Rik van Riel, Srikar Dronamraju,
	Thomas Gleixner, Valentin Schneider, Vincent Guittot

Currently we loop through all threads of a core to evaluate if the core
is idle or not. This is unnecessary. If a thread of a core is not
idle, skip evaluating other threads of a core.

Signed-off-by: Srikar Dronamraju <srikar@linux.vnet.ibm.com>
---
 kernel/sched/fair.c | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/kernel/sched/fair.c b/kernel/sched/fair.c
index 69a81a5709ff..b9d628128cfc 100644
--- a/kernel/sched/fair.c
+++ b/kernel/sched/fair.c
@@ -5872,10 +5872,12 @@ static int select_idle_core(struct task_struct *p, struct sched_domain *sd, int
 		bool idle = true;
 
 		for_each_cpu(cpu, cpu_smt_mask(core)) {
-			__cpumask_clear_cpu(cpu, cpus);
-			if (!available_idle_cpu(cpu))
+			if (!available_idle_cpu(cpu)) {
 				idle = false;
+				break;
+			}
 		}
+		cpumask_andnot(cpus, cpus, cpu_smt_mask(core));
 
 		if (idle)
 			return core;
-- 
2.18.1


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

end of thread, other threads:[~2019-12-06 16:57 UTC | newest]

Thread overview: 12+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-12-05 17:23 [PATCH] sched/fair: Optimize select_idle_core Srikar Dronamraju
2019-12-05 17:27 ` Vincent Guittot
2019-12-05 17:51   ` Srikar Dronamraju
2019-12-05 18:52     ` Vincent Guittot
2019-12-06  8:16       ` Srikar Dronamraju
2019-12-06 13:27         ` Vincent Guittot
2019-12-06 13:39           ` Srikar Dronamraju
2019-12-06 16:48             ` Vincent Guittot
2019-12-06 12:00 ` Valentin Schneider
2019-12-06 12:32   ` Peter Zijlstra
2019-12-06 12:53   ` Srikar Dronamraju
2019-12-06 16:57     ` Valentin Schneider

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).