[PATCH 1/2] clocksource: Fix opencoded cpumask_any_but() in clocksource_verify_choose_cpus()

Yury Norov posted 2 patches 6 months, 2 weeks ago
There is a newer version of this series
[PATCH 1/2] clocksource: Fix opencoded cpumask_any_but() in clocksource_verify_choose_cpus()
Posted by Yury Norov 6 months, 2 weeks ago
From: "Yury Norov [NVIDIA]" <yury.norov@gmail.com>

cpumask_any_but() is more verbose than cpumask_first() followed by
cpumask_next(). Use it in clocksource_verify_choose_cpus().

Acked-by: John Stultz <jstultz@google.com>
Signed-off-by: "Yury Norov [NVIDIA]" <yury.norov@gmail.com>
---
 kernel/time/clocksource.c | 4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)

diff --git a/kernel/time/clocksource.c b/kernel/time/clocksource.c
index 6a8bc7da9062..a2f2e9f4d37b 100644
--- a/kernel/time/clocksource.c
+++ b/kernel/time/clocksource.c
@@ -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);
-- 
2.43.0
Re: [PATCH 1/2] clocksource: Fix opencoded cpumask_any_but() in clocksource_verify_choose_cpus()
Posted by Thomas Gleixner 6 months, 1 week ago
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()
Posted by Yury Norov 6 months, 1 week ago
On Mon, Jun 09, 2025 at 12:03:23PM +0200, Thomas Gleixner wrote:
> 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'.
 
> 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()
Posted by Thomas Gleixner 6 months, 1 week ago
On Mon, Jun 09 2025 at 10:33, Yury Norov wrote:
> On Mon, Jun 09, 2025 at 12:03:23PM +0200, Thomas Gleixner wrote:
>> 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.