Commit 9fc4468d authored by Rasmus Villemoes's avatar Rasmus Villemoes Committed by Thomas Gleixner

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: default avatarRasmus Villemoes <linux@rasmusvillemoes.dk>
Cc: John Stultz <john.stultz@linaro.org>
Link: http://lkml.kernel.org/r/1443771931-6284-1-git-send-email-linux@rasmusvillemoes.dkSigned-off-by: default avatarThomas Gleixner <tglx@linutronix.de>
parent cfed432d
...@@ -874,7 +874,7 @@ unsigned long apply_slack(struct timer_list *timer, unsigned long expires) ...@@ -874,7 +874,7 @@ unsigned long apply_slack(struct timer_list *timer, unsigned long expires)
if (mask == 0) if (mask == 0)
return expires; return expires;
bit = find_last_bit(&mask, BITS_PER_LONG); bit = __fls(mask);
mask = (1UL << bit) - 1; mask = (1UL << bit) - 1;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment