summaryrefslogtreecommitdiffstats
path: root/kernel/sched
diff options
context:
space:
mode:
authorDietmar Eggemann <dietmar.eggemann@arm.com>2020-05-20 15:42:39 +0200
committerPeter Zijlstra <peterz@infradead.org>2020-06-15 14:10:04 +0200
commitc81b89329933c6c0be809d4c0d2cb57c49153ee3 (patch)
tree61e691ce0cd1a84035ecb5f7cf64fba8457a5c72 /kernel/sched
parent9b1b234bb86bcdcdb142e900d39b599185465dbb (diff)
downloadlinux-c81b89329933c6c0be809d4c0d2cb57c49153ee3.tar.bz2
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 <dietmar.eggemann@arm.com> Signed-off-by: Peter Zijlstra (Intel) <peterz@infradead.org> Acked-by: Juri Lelli <juri.lelli@redhat.com> Link: https://lkml.kernel.org/r/20200520134243.19352-2-dietmar.eggemann@arm.com
Diffstat (limited to 'kernel/sched')
-rw-r--r--kernel/sched/deadline.c8
1 files changed, 7 insertions, 1 deletions
diff --git a/kernel/sched/deadline.c b/kernel/sched/deadline.c
index f31964ad9c2e..ec90265e9d8e 100644
--- a/kernel/sched/deadline.c
+++ b/kernel/sched/deadline.c
@@ -54,10 +54,16 @@ static inline struct dl_bw *dl_bw_of(int i)
static inline int dl_bw_cpus(int i)
{
struct root_domain *rd = cpu_rq(i)->rd;
- int cpus = 0;
+ int cpus;
RCU_LOCKDEP_WARN(!rcu_read_lock_sched_held(),
"sched RCU must be held");
+
+ if (cpumask_subset(rd->span, cpu_active_mask))
+ return cpumask_weight(rd->span);
+
+ cpus = 0;
+
for_each_cpu_and(i, rd->span, cpu_active_mask)
cpus++;