mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH] timers/migration: remove an unneeded call to find_first_bit()
@ 2025-05-30 13:25 Petr Tesarik
  2025-06-06 12:05 ` Petr Tesarik
  0 siblings, 1 reply; 2+ messages in thread
From: Petr Tesarik @ 2025-05-30 13:25 UTC (permalink / raw)
  To: Anna-Maria Behnsen, Frederic Weisbecker, Thomas Gleixner
  Cc: open list:HIGH-RESOLUTION TIMERS, TIMER WHEEL, CLOCKEVENTS, Petr Tesarik

Use simple bit arithmetic to extract the least significant bit from the
active bitmask, because the bit position is not needed, only the bit
itself.

No functional change.

Signed-off-by: Petr Tesarik <ptesarik@suse.com>
---
 kernel/time/timer_migration.c | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/kernel/time/timer_migration.c b/kernel/time/timer_migration.c
index 2f6330831f08..0f40727b6cac 100644
--- a/kernel/time/timer_migration.c
+++ b/kernel/time/timer_migration.c
@@ -1277,12 +1277,12 @@ static bool tmigr_inactive_up(struct tmigr_group *group,
 			 * group is idle!
 			 */
 			if (!childstate.active) {
-				unsigned long new_migr_bit, active = newstate.active;
+				u8 active = newstate.active;
 
-				new_migr_bit = find_first_bit(&active, BIT_CNT);
+				if (active) {
+					u8 lsbit = active & -active;
 
-				if (new_migr_bit != BIT_CNT) {
-					newstate.migrator = BIT(new_migr_bit);
+					newstate.migrator = lsbit;
 				} else {
 					newstate.migrator = TMIGR_NONE;
 
-- 
2.49.0


^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2025-06-06 12:05 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2025-05-30 13:25 [PATCH] timers/migration: remove an unneeded call to find_first_bit() Petr Tesarik
2025-06-06 12:05 ` Petr Tesarik

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®