Skip to contentSkip to conversation

watchdog: fix opencoded cpumask_next_wrap() in watchdog_next_cpu()

PATCH In review Yury Norov 2 participants 3 messages Jun 5, 2025 – Jun 21, 2025

lore
Share & tools
lore

Yury Norov

author
#0 lore raw

PATCH 1/1 watchdog: fix opencoded cpumask_next_wrap() in watchdog_next_cpu()

From: Yury Norov [NVIDIA] <[email protected]>

The dedicated helper is more verbose and efficient comparing to cpumask_next() followed by cpumask_first().

---
 kernel/watchdog_buddy.c | 5 +----
 1 file changed, 1 insertion(+), 4 deletions(-)
kernel/watchdog_buddy.c +1 -4
index 34dbfe091f4b..ee754d767c21 100644
@@ -12,10 +12,7 @@ static unsigned int watchdog_next_cpu(unsigned int cpu)
 {
 	unsigned int next_cpu;
 
-	next_cpu = cpumask_next(cpu, &watchdog_cpus);
-	if (next_cpu >= nr_cpu_ids)
-		next_cpu = cpumask_first(&watchdog_cpus);
-
+	next_cpu = cpumask_next_wrap(cpu, &watchdog_cpus);
 	if (next_cpu == cpu)
 		return nr_cpu_ids;
 
Signature · 1 line
2.43.0
author
#2 lore raw
Quoted 9 lines · Doug Anderson

Hi,

Quoted 6 lines · Yury Norov

From: Yury Norov [NVIDIA] <[email protected]>

The dedicated helper is more verbose and efficient comparing to cpumask_next() followed by cpumask_first().

Quoted 6 lines
Quoted 4 lines
---
 kernel/watchdog_buddy.c | 5 +----
 1 file changed, 1 insertion(+), 4 deletions(-)

Thanks, Douglas. Adding in bitmap-for-next for testing.