path: root/kernel/time/timer.c
diff options
authorRasmus Villemoes <>2015-10-02 09:45:30 +0200
committerThomas Gleixner <>2015-10-11 22:13:46 +0200
commit9fc4468d546b6eb55b0aa5b04b0c36238ebf57e7 (patch)
tree07727d1e73f5745c306d944940ce3c703f13e244 /kernel/time/timer.c
parentcfed432d7f4114e16e0163bcfe65e96f0c304493 (diff)
timers: Use __fls in apply_slack()
In apply_slack(), find_last_bit() is applied to a bitmask consisting of precisely BITS_PER_LONG bits. Since mask is non-zero, we might as well eliminate the function call and use __fls() directly. On x86_64, this shaves 23 bytes of the only caller, mod_timer(). This also gets rid of Coverity CID 1192106, but that is a false positive: Coverity is not aware that mask != 0 implies that find_last_bit will not return BITS_PER_LONG. Signed-off-by: Rasmus Villemoes <> Cc: John Stultz <> Link: Signed-off-by: Thomas Gleixner <>
Diffstat (limited to 'kernel/time/timer.c')
1 files changed, 1 insertions, 1 deletions
diff --git a/kernel/time/timer.c b/kernel/time/timer.c
index d3f5e92f722a..74591ba9474f 100644
--- a/kernel/time/timer.c
+++ b/kernel/time/timer.c
@@ -874,7 +874,7 @@ unsigned long apply_slack(struct timer_list *timer, unsigned long expires)
if (mask == 0)
return expires;
- bit = find_last_bit(&mask, BITS_PER_LONG);
+ bit = __fls(mask);
mask = (1UL << bit) - 1;