sched/deadline: simplify dl_bw_cpus() using cpumask_weight_and()
PATCH 1/1 sched/deadline: simplify dl_bw_cpus() using cpumask_weight_and()
cpumask_weight_and() can be used to count of bits both in rd->span and cpu_active_mask. No functional change intended.
--- kernel/sched/deadline.c | 11 +---------- 1 file changed, 1 insertion(+), 10 deletions(-)
kernel/sched/deadline.c +1 -10
@@ -110,20 +110,11 @@ 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;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++; - -return cpus; +return cpumask_weight_and (rd->span, cpu_active_mask); }static inline unsigned long __dl_bw_capacity (const struct cpumask *mask)
Signature · 1 line
2.27.0
Quoted 22 lines · Miaohe Lin
cpumask_weight_and()can be used to count of bits both inrd->spanandcpu_active_mask. No functional change intended.Signed-off-by Miaohe Lin <[email protected]>--- kernel/sched/deadline.c | 11 +---------- 1 file changed, 1 insertion(+), 10 deletions(-)kernel/sched/deadline.c +0
-2@@ -110,20 +110,11 @@ 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;RCU_LOCKDEP_WARN (!rcu_read_lock_sched_held (),"sched RCU must be held" ); -if (cpumask_subset (rd->span, cpu_active_mask))
kernel/sched/deadline.c static inline struct dl_bw *dl_bw_of(int i) · line 118
Quoted 10 lines
kernel/sched/deadline.c +1
-8-return cpumask_weight (rd->span); - - cpus =0 ; - -for_each_cpu_and (i, rd->span, cpu_active_mask) - cpus++; - -return cpus; +return cpumask_weight_and (rd->span, cpu_active_mask); }
-- Mukesh
Quoted 2 lines
kernel/sched/deadline.c +0
-0static inline unsigned long __dl_bw_capacity (const struct cpumask *mask)
Quoted 24 lines · Miaohe Lin
cpumask_weight_and()can be used to count of bits both inrd->spanandcpu_active_mask. No functional change intended.Signed-off-by Miaohe Lin <[email protected]>--- kernel/sched/deadline.c | 11 +---------- 1 file changed, 1 insertion(+), 10 deletions(-)kernel/sched/deadline.c +0
-4@@ -110,20 +110,11 @@ 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;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); -
kernel/sched/deadline.c static inline struct dl_bw *dl_bw_of(int i) · line 120
Quoted 10 lines
kernel/sched/deadline.c +1
-6- cpus =0 ; - -for_each_cpu_and (i, rd->span, cpu_active_mask) - cpus++; - -return cpus; +return cpumask_weight_and (rd->span, cpu_active_mask); }static inline unsigned long __dl_bw_capacity (const struct cpumask *mask)
Quoted 4 lines · Miaohe Lin
cpumask_weight_and()can be used to count of bits both inrd->spanandcpu_active_mask. No functional change intended.Signed-off-by Miaohe Lin <[email protected]>
Quoted 4 lines · Miaohe Lin
cpumask_weight_and()can be used to count of bits both inrd->spanandcpu_active_mask. No functional change intended.Signed-off-by Miaohe Lin <[email protected]>
Thanks,
-- Daniel
Quoted 4 lines · Miaohe Lin
cpumask_weight_and()can be used to count of bits both inrd->spanandcpu_active_mask. No functional change intended.Signed-off-by Miaohe Lin <[email protected]>
friendly ping... :)
Quoted 31 lines
--- kernel/sched/deadline.c | 11 +---------- 1 file changed, 1 insertion(+), 10 deletions(-)kernel/sched/deadline.c +1
-10@@ -110,20 +110,11 @@ 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;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++; - -return cpus; +return cpumask_weight_and (rd->span, cpu_active_mask); }static inline unsigned long __dl_bw_capacity (const struct cpumask *mask)
Phil Auld
Reviewed-byQuoted 7 lines · On Tue, Jun 13, 2023 at 08:19:22PM +0800 Miaohe Lin wrote:
Quoted 4 lines · Miaohe Lin
cpumask_weight_and()can be used to count of bits both inrd->spanandcpu_active_mask. No functional change intended.Signed-off-by Miaohe Lin <[email protected]>friendly ping... :)
This looks reasonable, and better, to me.
Quoted 33 lines
Quoted 32 lines
--- kernel/sched/deadline.c | 11 +---------- 1 file changed, 1 insertion(+), 10 deletions(-)kernel/sched/deadline.c +1
-10@@ -110,20 +110,11 @@ 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;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++; - -return cpus; +return cpumask_weight_and (rd->span, cpu_active_mask); }static inline unsigned long __dl_bw_capacity (const struct cpumask *mask)
Quoted 5 lines · Phil Auld
Quoted 4 lines · On Tue, Jun 13, 2023 at 08:19:22PM +0800 Miaohe Lin wrote:
Quoted 3 lines · Miaohe Lin
cpumask_weight_and()can be used to count of bits both inrd->spanandcpu_active_mask. No functional change intended.
Quoted 7 lines
Quoted 3 lines
Quoted 1 line
Signed-off-by Miaohe Lin <[email protected]>friendly ping... :)
This looks reasonable, and better, to me.
Reviewed-by Phil Auld <[email protected]>
Many thanks for all of your reviews. :)
Quoted 35 lines
Quoted 34 lines
Quoted 33 lines
--- kernel/sched/deadline.c | 11 +---------- 1 file changed, 1 insertion(+), 10 deletions(-)kernel/sched/deadline.c +1
-10@@ -110,20 +110,11 @@ 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;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++; - -return cpus; +return cpumask_weight_and (rd->span, cpu_active_mask); }static inline unsigned long __dl_bw_capacity (const struct cpumask *mask)