clocksource: Use better cpumask API where appropriate
cover clocksource: Use better cpumask API where appropriate
From: Yury Norov [NVIDIA] <[email protected]>
The dedicated API works better and improves on readability
Resend: drop 'fix opencoded...' wording (Tomas)
v2: https://lore.kernel.org/all/[email protected]/
v1: https://lore.kernel.org/all/[email protected]/
Yury Norov [NVIDIA] (2):
clocksource: Use cpumask_any_but() in clocksource_verify_choose_cpus()
clocksource: Use cpumask_next_wrap() in clocksource_watchdog()
kernel/time/clocksource.c | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-)
Signature · 1 line
2.43.0
PATCH 1/2 clocksource: Use cpumask_any_but() in clocksource_verify_choose_cpus()
From: "Yury Norov [NVIDIA]" <[email protected]>
cpumask_any_but() is more verbose than cpumask_first() followed by cpumask_next(). Use it in clocksource_verify_choose_cpus().
--- kernel/time/clocksource.c | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-)
kernel/time/clocksource.c +1 -3
@@ -323,9 +323,7 @@ static void clocksource_verify_choose_cpus(void)return ;/* Make sure to select at least one CPU other than the current CPU. */ - cpu =cpumask_first (cpu_online_mask); -if (cpu ==smp_processor_id ()) - cpu =cpumask_next (cpu, cpu_online_mask); + cpu =cpumask_any_but (cpu_online_mask,smp_processor_id ());if (WARN_ON_ONCE (cpu >= nr_cpu_ids))return ;cpumask_set_cpu (cpu, &cpus_chosen);
Signature · 1 line
2.43.0
[tip: timers/core] clocksource: Use cpumask_any_but() in clocksource_verify_choose_cpus()
The following commit has been merged into the timers/core branch of tip:
The following commit has been merged into the timers/core branch of tip:
Commit-ID: 4fa7d61d5a02ad57a05c69365db293afddf678fc Gitweb: https://git.kernel.org/tip/4fa7d61d5a02ad57a05c69365db293afddf678fc Author: Yury Norov [NVIDIA] <[email protected]> AuthorDate: Sat, 14 Jun 2025 11:50:29 -04:00 Committer: Thomas Gleixner <[email protected]> CommitterDate: Sat, 14 Jun 2025 20:09:44 +02:00
clocksource: Use cpumask_any_but() in clocksource_verify_choose_cpus()
cpumask_any_but() is more verbose than cpumask_first() followed by cpumask_next(). Use it in clocksource_verify_choose_cpus().
--- kernel/time/clocksource.c | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-)
kernel/time/clocksource.c +1 -3
@@ -323,9 +323,7 @@ static void clocksource_verify_choose_cpus(void)return ;/* Make sure to select at least one CPU other than the current CPU. */ - cpu =cpumask_first (cpu_online_mask); -if (cpu ==smp_processor_id ()) - cpu =cpumask_next (cpu, cpu_online_mask); + cpu =cpumask_any_but (cpu_online_mask,smp_processor_id ());if (WARN_ON_ONCE (cpu >= nr_cpu_ids))return ;cpumask_set_cpu (cpu, &cpus_chosen);
PATCH 2/2 clocksource: Use cpumask_next_wrap() in clocksource_watchdog()
In reply to Yury NorovFrom: "Yury Norov [NVIDIA]" <[email protected]>
cpumask_next_wrap() is more verbose and efficient comparing to cpumask_next() followed by cpumask_first().
--- kernel/time/clocksource.c | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-)
kernel/time/clocksource.c +1 -3
@@ -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
Signature · 1 line
2.43.0
[tip: timers/core] clocksource: Use cpumask_next_wrap() in clocksource_watchdog()
The following commit has been merged into the timers/core branch of tip:
The following commit has been merged into the timers/core branch of tip:
Commit-ID: bfa788dc2ddaea7d7930f63a5c7c8f3668a3f2c5 Gitweb: https://git.kernel.org/tip/bfa788dc2ddaea7d7930f63a5c7c8f3668a3f2c5 Author: Yury Norov [NVIDIA] <[email protected]> AuthorDate: Sat, 14 Jun 2025 11:50:30 -04:00 Committer: Thomas Gleixner <[email protected]> CommitterDate: Sat, 14 Jun 2025 20:09:44 +02:00
clocksource: Use cpumask_next_wrap() in clocksource_watchdog()
cpumask_next_wrap() is more verbose and efficient comparing to cpumask_next() followed by cpumask_first().
--- kernel/time/clocksource.c | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-)
kernel/time/clocksource.c +1 -3
@@ -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
Quoted 5 lines · Yury Norov
From: Yury Norov [NVIDIA] <[email protected]>
The dedicated API works better and improves on readability
Resend: drop 'fix opencoded...' wording (Tomas)
This is not a resend as you changed the change log, so it's V3.
Resend is only for unmodified versions where you got no feedback and did not change anything.
And in the RESEND case you have to keep the version number so stuff can be identified as resend of a particular version.
People have scripts which depend on submitters following the rules. Chasing stuff by hand is just waste of time.
Thanks,
tglx