diff options
author | Yury Norov <yury.norov@gmail.com> | 2022-01-23 10:38:53 -0800 |
---|---|---|
committer | Paul E. McKenney <paulmck@kernel.org> | 2022-02-14 10:36:58 -0800 |
commit | 6a2c1d450a6a328027280a854019c55de989e14e (patch) | |
tree | 1925663bebf81e6f9681cf7e7be9730dc6f3cc98 /kernel/rcu/tree_plugin.h | |
parent | rcu: Remove __read_mostly annotations from rcu_scheduler_active externs (diff) | |
download | wireguard-linux-6a2c1d450a6a328027280a854019c55de989e14e.tar.xz wireguard-linux-6a2c1d450a6a328027280a854019c55de989e14e.zip |
rcu: Replace cpumask_weight with cpumask_empty where appropriate
In some places, RCU code calls cpumask_weight() to check if any bit of a
given cpumask is set. We can do it more efficiently with cpumask_empty()
because cpumask_empty() stops traversing the cpumask as soon as it finds
first set bit, while cpumask_weight() counts all bits unconditionally.
Signed-off-by: Yury Norov <yury.norov@gmail.com>
Acked-by: Frederic Weisbecker <frederic@kernel.org>
Signed-off-by: Paul E. McKenney <paulmck@kernel.org>
Diffstat (limited to 'kernel/rcu/tree_plugin.h')
-rw-r--r-- | kernel/rcu/tree_plugin.h | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/kernel/rcu/tree_plugin.h b/kernel/rcu/tree_plugin.h index 07845dcd33c5..efd0c87d2ffa 100644 --- a/kernel/rcu/tree_plugin.h +++ b/kernel/rcu/tree_plugin.h @@ -1220,7 +1220,7 @@ static void rcu_boost_kthread_setaffinity(struct rcu_node *rnp, int outgoingcpu) cpu != outgoingcpu) cpumask_set_cpu(cpu, cm); cpumask_and(cm, cm, housekeeping_cpumask(HK_FLAG_RCU)); - if (cpumask_weight(cm) == 0) + if (cpumask_empty(cm)) cpumask_copy(cm, housekeeping_cpumask(HK_FLAG_RCU)); set_cpus_allowed_ptr(t, cm); mutex_unlock(&rnp->boost_kthread_mutex); |