timers/migration: remove an unneeded call to find_first_bit()
PATCH 1/1 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 <[email protected]>
--- kernel/time/timer_migration.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-)
kernel/time/timer_migration.c +4 -4
@@ -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 ;
Signature · 1 line
2.49.0
Quoted 3 lines · On Fri, 30 May 2025 15:25:39 +0200 Petr Tesarik <[email protected]> wrote:
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.
There has been no reply here, but I received an out-of-band recommendation to wrap this bit-twiddling trick in a macro.
So, you can ignore this patch for now and wait for a respin after I add the macro and convert pre-existing uses in the kernel.
Petr T
Quoted 28 lines
No functional change.
Signed-off-by Petr Tesarik <[email protected]>--- kernel/time/timer_migration.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-)kernel/time/timer_migration.c +4
-4@@ -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 ;