lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [day] [month] [year] [list]
Message-ID: <20250530132539.234792-1-ptesarik@suse.com>
Date: Fri, 30 May 2025 15:25:39 +0200
From: Petr Tesarik <ptesarik@...e.com>
To: Anna-Maria Behnsen <anna-maria@...utronix.de>,
	Frederic Weisbecker <frederic@...nel.org>,
	Thomas Gleixner <tglx@...utronix.de>
Cc: linux-kernel@...r.kernel.org (open list:HIGH-RESOLUTION TIMERS, TIMER WHEEL, CLOCKEVENTS),
	Petr Tesarik <ptesarik@...e.com>
Subject: [PATCH] timers/migration: remove an unneeded call to find_first_bit()

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@...e.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


Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ