From: Yury Norov [NVIDIA] Date: Sat, 14 Jun 2025 15:50:30 +0000 (-0400) Subject: clocksource: Use cpumask_next_wrap() in clocksource_watchdog() X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=bfa788dc2ddaea7d7930f63a5c7c8f3668a3f2c5;p=thirdparty%2Fkernel%2Fstable.git clocksource: Use cpumask_next_wrap() in clocksource_watchdog() cpumask_next_wrap() is more verbose and efficient comparing to cpumask_next() followed by cpumask_first(). Signed-off-by: Yury Norov [NVIDIA] Signed-off-by: Thomas Gleixner Acked-by: John Stultz Link: https://lore.kernel.org/all/20250614155031.340988-3-yury.norov@gmail.com --- diff --git a/kernel/time/clocksource.c b/kernel/time/clocksource.c index a2f2e9f4d37b..e400fe150f9d 100644 --- a/kernel/time/clocksource.c +++ b/kernel/time/clocksource.c @@ -587,9 +587,7 @@ static void clocksource_watchdog(struct timer_list *unused) * Cycle through CPUs to check if the CPUs stay synchronized * to each other. */ - next_cpu = cpumask_next(raw_smp_processor_id(), cpu_online_mask); - if (next_cpu >= nr_cpu_ids) - next_cpu = cpumask_first(cpu_online_mask); + next_cpu = cpumask_next_wrap(raw_smp_processor_id(), cpu_online_mask); /* * Arm timer if not already pending: could race with concurrent