Skip to content

Commit c81b893

Browse files
deggemanPeter Zijlstra
authored andcommitted
sched/deadline: Optimize dl_bw_cpus()
Return the weight of the root domain (rd) span in case it is a subset of the cpu_active_mask. Continue to compute the number of CPUs over rd span and cpu_active_mask when in hotplug. Signed-off-by: Dietmar Eggemann <[email protected]> Signed-off-by: Peter Zijlstra (Intel) <[email protected]> Acked-by: Juri Lelli <[email protected]> Link: https://lkml.kernel.org/r/[email protected]
1 parent 9b1b234 commit c81b893

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

kernel/sched/deadline.c

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -54,10 +54,16 @@ static inline struct dl_bw *dl_bw_of(int i)
5454
static inline int dl_bw_cpus(int i)
5555
{
5656
struct root_domain *rd = cpu_rq(i)->rd;
57-
int cpus = 0;
57+
int cpus;
5858

5959
RCU_LOCKDEP_WARN(!rcu_read_lock_sched_held(),
6060
"sched RCU must be held");
61+
62+
if (cpumask_subset(rd->span, cpu_active_mask))
63+
return cpumask_weight(rd->span);
64+
65+
cpus = 0;
66+
6167
for_each_cpu_and(i, rd->span, cpu_active_mask)
6268
cpus++;
6369

0 commit comments

Comments
 (0)