[PATCH 38/54] arch/mips: replace cpumask_weight with cpumask_weight_{eq, ...} where appropriate
From: Yury Norov
Date: Sun Jan 23 2022 - 13:43:00 EST
- Next message: Yury Norov: "[PATCH 39/54] arch/powerpc: replace cpumask_weight with cpumask_weight_{eq, ...} where appropriate"
- Previous message: Yury Norov: "[PATCH 36/54] lib/cpumask: add cpumask_weight_{eq,gt,ge,lt,le}"
- In reply to: Yury Norov: "[PATCH 36/54] lib/cpumask: add cpumask_weight_{eq,gt,ge,lt,le}"
- Next in thread: Yury Norov: "[PATCH 39/54] arch/powerpc: replace cpumask_weight with cpumask_weight_{eq, ...} where appropriate"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Mips code uses calls cpumask_weight() to compare the weight of
cpumask with a given number. We can do it more efficiently with
cpumask_weight_{eq, ...} because conditional cpumask_weight may stop
traversing the cpumask earlier, as soon as condition is met.
Signed-off-by: Yury Norov <yury.norov@xxxxxxxxx>
---
arch/mips/cavium-octeon/octeon-irq.c | 4 ++--
arch/mips/kernel/crash.c | 2 +-
2 files changed, 3 insertions(+), 3 deletions(-)
diff --git a/arch/mips/cavium-octeon/octeon-irq.c b/arch/mips/cavium-octeon/octeon-irq.c
index 844f882096e6..914871f15fb7 100644
--- a/arch/mips/cavium-octeon/octeon-irq.c
+++ b/arch/mips/cavium-octeon/octeon-irq.c
@@ -763,7 +763,7 @@ static void octeon_irq_cpu_offline_ciu(struct irq_data *data)
if (!cpumask_test_cpu(cpu, mask))
return;
- if (cpumask_weight(mask) > 1) {
+ if (cpumask_weight_gt(mask, 1)) {
/*
* It has multi CPU affinity, just remove this CPU
* from the affinity set.
@@ -795,7 +795,7 @@ static int octeon_irq_ciu_set_affinity(struct irq_data *data,
* This removes the need to do locking in the .ack/.eoi
* functions.
*/
- if (cpumask_weight(dest) != 1)
+ if (!cpumask_weight_eq(dest, 1))
return -EINVAL;
if (!enable_one)
diff --git a/arch/mips/kernel/crash.c b/arch/mips/kernel/crash.c
index 81845ba04835..5b690d52491f 100644
--- a/arch/mips/kernel/crash.c
+++ b/arch/mips/kernel/crash.c
@@ -72,7 +72,7 @@ static void crash_kexec_prepare_cpus(void)
*/
pr_emerg("Sending IPI to other cpus...\n");
msecs = 10000;
- while ((cpumask_weight(&cpus_in_crash) < ncpus) && (--msecs > 0)) {
+ while (cpumask_weight_lt(&cpus_in_crash, ncpus) && (--msecs > 0)) {
cpu_relax();
mdelay(1);
}
--
2.30.2
- Next message: Yury Norov: "[PATCH 39/54] arch/powerpc: replace cpumask_weight with cpumask_weight_{eq, ...} where appropriate"
- Previous message: Yury Norov: "[PATCH 36/54] lib/cpumask: add cpumask_weight_{eq,gt,ge,lt,le}"
- In reply to: Yury Norov: "[PATCH 36/54] lib/cpumask: add cpumask_weight_{eq,gt,ge,lt,le}"
- Next in thread: Yury Norov: "[PATCH 39/54] arch/powerpc: replace cpumask_weight with cpumask_weight_{eq, ...} where appropriate"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]