* [PATCH 0/2] clocksource: use better cpumask API where appropriate
@ 2025-06-04 23:25 Yury Norov
2025-06-04 23:25 ` [PATCH 1/2] clocksource: fix opencoded cpumask_any_but() in clocksource_verify_choose_cpus() Yury Norov
2025-06-04 23:25 ` [PATCH 2/2] clocksource: fix opencoded cpumask_next_wrap() Yury Norov
0 siblings, 2 replies; 6+ messages in thread
From: Yury Norov @ 2025-06-04 23:25 UTC (permalink / raw)
To: linux-kernel, John Stultz, Thomas Gleixner, Stephen Boyd
Cc: Yury Norov [NVIDIA]
From: Yury Norov [NVIDIA] <yury.norov@gmail.com>
The dedicated API works better and improves on readability.
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(-)
--
2.43.0
^ permalink raw reply [flat|nested] 6+ messages in thread
* [PATCH 1/2] clocksource: fix opencoded cpumask_any_but() in clocksource_verify_choose_cpus()
2025-06-04 23:25 [PATCH 0/2] clocksource: use better cpumask API where appropriate Yury Norov
@ 2025-06-04 23:25 ` Yury Norov
2025-06-05 18:13 ` John Stultz
2025-06-04 23:25 ` [PATCH 2/2] clocksource: fix opencoded cpumask_next_wrap() Yury Norov
1 sibling, 1 reply; 6+ messages in thread
From: Yury Norov @ 2025-06-04 23:25 UTC (permalink / raw)
To: linux-kernel, John Stultz, Thomas Gleixner, Stephen Boyd
Cc: Yury Norov [NVIDIA]
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().
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 4b005b2f3ef5..2e24ce884272 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
^ permalink raw reply related [flat|nested] 6+ messages in thread
* [PATCH 2/2] clocksource: fix opencoded cpumask_next_wrap()
2025-06-04 23:25 [PATCH 0/2] clocksource: use better cpumask API where appropriate Yury Norov
2025-06-04 23:25 ` [PATCH 1/2] clocksource: fix opencoded cpumask_any_but() in clocksource_verify_choose_cpus() Yury Norov
@ 2025-06-04 23:25 ` Yury Norov
2025-06-05 18:11 ` John Stultz
1 sibling, 1 reply; 6+ messages in thread
From: Yury Norov @ 2025-06-04 23:25 UTC (permalink / raw)
To: linux-kernel, John Stultz, Thomas Gleixner, Stephen Boyd
Cc: Yury Norov [NVIDIA]
From: Yury Norov [NVIDIA] <yury.norov@gmail.com>
cpumask_next_wrap() is more verbose and efficient comparing to
cpumask_next() followed by cpumask_first().
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 2e24ce884272..0aef0e349e49 100644
--- a/kernel/time/clocksource.c
+++ b/kernel/time/clocksource.c
@@ -584,9 +584,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
--
2.43.0
^ permalink raw reply related [flat|nested] 6+ messages in thread
* Re: [PATCH 2/2] clocksource: fix opencoded cpumask_next_wrap()
2025-06-04 23:25 ` [PATCH 2/2] clocksource: fix opencoded cpumask_next_wrap() Yury Norov
@ 2025-06-05 18:11 ` John Stultz
0 siblings, 0 replies; 6+ messages in thread
From: John Stultz @ 2025-06-05 18:11 UTC (permalink / raw)
To: Yury Norov; +Cc: linux-kernel, Thomas Gleixner, Stephen Boyd
On Wed, Jun 4, 2025 at 4:25 PM Yury Norov <yury.norov@gmail.com> wrote:
>
> From: Yury Norov [NVIDIA] <yury.norov@gmail.com>
>
> cpumask_next_wrap() is more verbose and efficient comparing to
> cpumask_next() followed by cpumask_first().
>
> 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 2e24ce884272..0aef0e349e49 100644
> --- a/kernel/time/clocksource.c
> +++ b/kernel/time/clocksource.c
> @@ -584,9 +584,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);
>
This looks ok to me. The only nit is that often folks like to see the
$Subject line look like:
$topic: Capitalized description.
So for this one:
clocksource: Fix opencoded cpumask_next_wrap()
Acked-by: John Stultz <jstultz@google.com>
thanks
-john
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH 1/2] clocksource: fix opencoded cpumask_any_but() in clocksource_verify_choose_cpus()
2025-06-04 23:25 ` [PATCH 1/2] clocksource: fix opencoded cpumask_any_but() in clocksource_verify_choose_cpus() Yury Norov
@ 2025-06-05 18:13 ` John Stultz
0 siblings, 0 replies; 6+ messages in thread
From: John Stultz @ 2025-06-05 18:13 UTC (permalink / raw)
To: Yury Norov; +Cc: linux-kernel, Thomas Gleixner, Stephen Boyd
On Wed, Jun 4, 2025 at 4:25 PM Yury Norov <yury.norov@gmail.com> wrote:
>
> 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().
>
> 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 4b005b2f3ef5..2e24ce884272 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);
Acked-by: John Stultz <jstultz@google.com>
Same nit comment from the other patch, just need to capitalize the
commit description in the subject.
"clocksource: Fix opencoded..."
thanks
-john
^ permalink raw reply [flat|nested] 6+ messages in thread
* [PATCH 0/2] clocksource: Use better cpumask API where appropriate
@ 2025-06-07 14:11 Yury Norov
0 siblings, 0 replies; 6+ messages in thread
From: Yury Norov @ 2025-06-07 14:11 UTC (permalink / raw)
To: linux-kernel, John Stultz, Thomas Gleixner, Stephen Boyd
Cc: Yury Norov [NVIDIA]
From: Yury Norov [NVIDIA] <yury.norov@gmail.com>
The dedicated API works better and improves on readability
V2: Capitalize commit message names
v1: https://lore.kernel.org/all/20250604232550.40491-1-yury.norov@gmail.com/
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(-)
--
2.43.0
^ permalink raw reply [flat|nested] 6+ messages in thread
end of thread, other threads:[~2025-06-07 14:11 UTC | newest]
Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-06-04 23:25 [PATCH 0/2] clocksource: use better cpumask API where appropriate Yury Norov
2025-06-04 23:25 ` [PATCH 1/2] clocksource: fix opencoded cpumask_any_but() in clocksource_verify_choose_cpus() Yury Norov
2025-06-05 18:13 ` John Stultz
2025-06-04 23:25 ` [PATCH 2/2] clocksource: fix opencoded cpumask_next_wrap() Yury Norov
2025-06-05 18:11 ` John Stultz
-- strict thread matches above, loose matches on Subject: below --
2025-06-07 14:11 [PATCH 0/2] clocksource: Use better cpumask API where appropriate Yury Norov
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).