[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20250613033447.3531709-3-richard120310@gmail.com>
Date: Fri, 13 Jun 2025 11:34:47 +0800
From: I Hsin Cheng <richard120310@...il.com>
To: yury.norov@...il.com
Cc: linux@...musvillemoes.dk,
jstultz@...gle.com,
tglx@...utronix.de,
sboyd@...nel.org,
linux-kernel@...r.kernel.org,
eleanor15x@...il.com,
visitorckw@...il.com,
jserv@...s.ncku.edu.tw,
skhan@...uxfoundation.org,
linux-kernel-mentees@...ts.linux.dev,
I Hsin Cheng <richard120310@...il.com>
Subject: [RFC PATCH 2/2] clocksource: Use cpumask_first_but() in clocksource_verify_choose_cpus()
Utilize cpumask_first_but() helper instead of first using
cpumask_first() and then cpumask_next(). The logic is the same here,
using the new helper will make it more conscious.
Use bloat-o-meter to check the impact on code size, the result is the
same, does not have positive impact nor negative impact.
$ ./scripts/bloat-o-meter vmlinux_old vmlinux_new
add/remove: 0/0 grow/shrink: 0/0 up/down: 0/0 (0)
Function old new delta
Total: Before=22590709, After=22590709, chg +0.00%
Signed-off-by: I Hsin Cheng <richard120310@...il.com>
---
Generally speaking, I think this is just a small tweak on the code,
making it more readable. However, no benefit in code size or performance
as the implementation behind the helper is in fact the same as the one
used here.
Maybe more tests should be done to ensure the change is solid, I hope to
seek some suggestions from everyone who has any ideas, or this is enough
then it's good.
Best regards,
I Hsin Cheng
---
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 bb48498ebb5a..12ff0c048570 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_first_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
Powered by blists - more mailing lists