lkml.org 
[lkml]   [2024]   [Aug]   [2]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
From
Subject[PATCH 2/2] sched/topology: optimize topology_span_sane()
Date
The function may call cpumask_equal with tl->mask(cpu) == tl->mask(i),
even when cpu != i. In such case, cpumask_equal() would always return
true, and we can proceed to the next iteration immediately.

Signed-off-by: Yury Norov <yury.norov@gmail.com>
---
kernel/sched/topology.c | 2 ++
1 file changed, 2 insertions(+)

diff --git a/kernel/sched/topology.c b/kernel/sched/topology.c
index 754ad5fa3c99..571759606954 100644
--- a/kernel/sched/topology.c
+++ b/kernel/sched/topology.c
@@ -2368,6 +2368,8 @@ static bool topology_span_sane(struct sched_domain_topology_level *tl,
*/
for_each_cpu_from(i, cpu_map) {
mi = tl->mask(i);
+ if (mi == mc)
+ continue;

/*
* We should 'and' all those masks with 'cpu_map' to exactly
--
2.43.0

\
 
 \ /
  Last update: 2024-08-02 19:58    [from the cache]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and my Meterkast|Read the blog