mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Yury Norov <yury.norov@gmail.com>
To: linux-kernel@vger.kernel.org, John Stultz <jstultz@google.com>,
	Thomas Gleixner <tglx@linutronix.de>,
	Stephen Boyd <sboyd@kernel.org>
Cc: "Yury Norov [NVIDIA]" <yury.norov@gmail.com>
Subject: [PATCH 1/2] clocksource: fix opencoded cpumask_any_but() in clocksource_verify_choose_cpus()
Date: Wed,  4 Jun 2025 19:25:47 -0400	[thread overview]
Message-ID: <20250604232550.40491-2-yury.norov@gmail.com> (raw)
In-Reply-To: <20250604232550.40491-1-yury.norov@gmail.com>

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


  reply	other threads:[~2025-06-04 23:25 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-06-04 23:25 [PATCH 0/2] clocksource: use better cpumask API where appropriate Yury Norov
2025-06-04 23:25 ` Yury Norov [this message]
2025-06-05 18:13   ` [PATCH 1/2] clocksource: fix opencoded cpumask_any_but() in clocksource_verify_choose_cpus() 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
2025-06-07 14:11 [PATCH 0/2] clocksource: Use better cpumask API where appropriate Yury Norov
2025-06-07 14:11 ` [PATCH 1/2] clocksource: Fix opencoded cpumask_any_but() in clocksource_verify_choose_cpus() Yury Norov
2025-06-09 10:03   ` Thomas Gleixner
2025-06-09 14:33     ` Yury Norov
2025-06-10  9:03       ` Thomas Gleixner

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20250604232550.40491-2-yury.norov@gmail.com \
    --to=yury.norov@gmail.com \
    --cc=jstultz@google.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=sboyd@kernel.org \
    --cc=tglx@linutronix.de \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®