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
V2: Capitalize commit message names
v1: https://lore.kernel.org/all/[email protected]/
Yury Norov [NVIDIA] (2):
clocksource: Fix opencoded cpumask_any_but() in
clocksource_verify_choose_cpus()
clocksource: Fix opencoded cpumask_next_wrap()
kernel/time/clocksource.c | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-)
Signature · 1 line
2.43.0
PATCH 1/2 clocksource: Fix opencoded 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
Re: [PATCH 1/2] clocksource: Fix opencoded cpumask_any_but() in clocksource_verify_choose_cpus()
On Sat, Jun 07 2025 at 10:11, Yury Norov wrote:
Why are you so obsessed to slap 'Fix' on every subject line?
This fixes absolutely nothing at all.
All it does is to replace a open coded sequence by appropriate function. So describe the changes accurately.
Thanks,
tglx
Re: [PATCH 1/2] clocksource: Fix opencoded cpumask_any_but() in clocksource_verify_choose_cpus()
Quoted 5 lines · Thomas Gleixner
On Sat, Jun 07 2025 at 10:11, Yury Norov wrote:
Why are you so obsessed to slap 'Fix' on every subject line?
This fixes absolutely nothing at all.
Opencoding helpers is an error, isn't? That's why 'fix'.
Quoted 2 lines
All it does is to replace a open coded sequence by appropriate function. So describe the changes accurately.
I'm not attached to words. If you prefer 'replace', I can resend with the wording you like. Please advise.
Thanks,
Yury
Re: [PATCH 1/2] clocksource: Fix opencoded cpumask_any_but() in clocksource_verify_choose_cpus()
Quoted 8 lines · Yury Norov
Quoted 5 lines · Thomas Gleixner
On Sat, Jun 07 2025 at 10:11, Yury Norov wrote:
Why are you so obsessed to slap 'Fix' on every subject line?
This fixes absolutely nothing at all.
Opencoding helpers is an error, isn't? That's why 'fix'.
It's not. It's functionally correct, so there is no error. It's an oversight in terms of code efficiency, not more.
PATCH 2/2 clocksource: Fix opencoded cpumask_next_wrap()
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