Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1244214 > unrolled thread

[tip:timers/core] timers: Use __fls in apply_slack()

Started bytip-bot for Rasmus Villemoes <tipbot@zytor.com>
First post2015-10-11 22:20 +0200
Last post2015-10-11 22:20 +0200
Articles 1 — 1 participant

Back to article view | Back to linux.kernel

This discussion starts older than the indexed window; earlier articles aren't shown. The article labeled Started by below is the oldest one visible, not the original post.


Contents

  [tip:timers/core] timers: Use __fls in apply_slack() tip-bot for Rasmus Villemoes <tipbot@zytor.com> - 2015-10-11 22:20 +0200

#1244214 — [tip:timers/core] timers: Use __fls in apply_slack()

Fromtip-bot for Rasmus Villemoes <tipbot@zytor.com>
Date2015-10-11 22:20 +0200
Subject[tip:timers/core] timers: Use __fls in apply_slack()
Message-ID<qivg6-267-13@gated-at.bofh.it>
Commit-ID:  9fc4468d546b6eb55b0aa5b04b0c36238ebf57e7
Gitweb:     http://git.kernel.org/tip/9fc4468d546b6eb55b0aa5b04b0c36238ebf57e7
Author:     Rasmus Villemoes <linux@rasmusvillemoes.dk>
AuthorDate: Fri, 2 Oct 2015 09:45:30 +0200
Committer:  Thomas Gleixner <tglx@linutronix.de>
CommitDate: Sun, 11 Oct 2015 22:13:46 +0200

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 <linux@rasmusvillemoes.dk>
Cc: John Stultz <john.stultz@linaro.org>
Link: http://lkml.kernel.org/r/1443771931-6284-1-git-send-email-linux@rasmusvillemoes.dk
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
---
 kernel/time/timer.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/kernel/time/timer.c b/kernel/time/timer.c
index d3f5e92..74591ba 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;
 
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

[toc] | [standalone]


Back to top | Article view | linux.kernel


csiph-web