timer: optimize apply_slack()
__fls(mask) is equivalent to find_last_bit(&mask, BITS_PER_LONG), but cheaper.
find_last_bit was showing up high on the list when I was profiling for stalls
on icache misses on a system with very small cache size (MIPS).
Signed-off-by: Felix Fietkau <nbd@openwrt.org>
Signed-off-by: edoko <r_data@naver.com>
Change-Id: I8a5021a2fb2936c00ffd456663a76cb1b23e3100
diff --git a/kernel/timer.c b/kernel/timer.c
index 441e6d0..0d19b32 100644
--- a/kernel/timer.c
+++ b/kernel/timer.c
@@ -814,7 +814,7 @@
if (mask == 0)
return expires;
- bit = find_last_bit(&mask, BITS_PER_LONG);
+ bit = __fls(mask);
mask = (1UL << bit) - 1;