mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH] kernel: time: timer.c: use __fls in apply_slack()
@ 2015-10-02  7:45 Rasmus Villemoes
  2015-10-11 20:09 ` [tip:timers/core] timers: Use " tip-bot for Rasmus Villemoes
  2015-10-11 20:15 ` tip-bot for Rasmus Villemoes
  0 siblings, 2 replies; 3+ messages in thread
From: Rasmus Villemoes @ 2015-10-02  7:45 UTC (permalink / raw)
  To: John Stultz, Thomas Gleixner; +Cc: Rasmus Villemoes, linux-kernel

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>
---
 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 84190f02b521..71eb089d1030 100644
--- a/kernel/time/timer.c
+++ b/kernel/time/timer.c
@@ -867,7 +867,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;
 
-- 
2.1.3


^ permalink raw reply	[flat|nested] 3+ messages in thread

* [tip:timers/core] timers: Use __fls in apply_slack()
  2015-10-02  7:45 [PATCH] kernel: time: timer.c: use __fls in apply_slack() Rasmus Villemoes
@ 2015-10-11 20:09 ` tip-bot for Rasmus Villemoes
  2015-10-11 20:15 ` tip-bot for Rasmus Villemoes
  1 sibling, 0 replies; 3+ messages in thread
From: tip-bot for Rasmus Villemoes @ 2015-10-11 20:09 UTC (permalink / raw)
  To: linux-tip-commits; +Cc: tglx, mingo, linux, linux-kernel, hpa, john.stultz

Commit-ID:  3e17510cbc3e75cae0c96fa38ca469ffe754aedf
Gitweb:     http://git.kernel.org/tip/3e17510cbc3e75cae0c96fa38ca469ffe754aedf
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:07:23 +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;
 

^ permalink raw reply	[flat|nested] 3+ messages in thread

* [tip:timers/core] timers: Use __fls in apply_slack()
  2015-10-02  7:45 [PATCH] kernel: time: timer.c: use __fls in apply_slack() Rasmus Villemoes
  2015-10-11 20:09 ` [tip:timers/core] timers: Use " tip-bot for Rasmus Villemoes
@ 2015-10-11 20:15 ` tip-bot for Rasmus Villemoes
  1 sibling, 0 replies; 3+ messages in thread
From: tip-bot for Rasmus Villemoes @ 2015-10-11 20:15 UTC (permalink / raw)
  To: linux-tip-commits; +Cc: linux, mingo, hpa, john.stultz, linux-kernel, tglx

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;
 

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2015-10-11 20:16 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-10-02  7:45 [PATCH] kernel: time: timer.c: use __fls in apply_slack() Rasmus Villemoes
2015-10-11 20:09 ` [tip:timers/core] timers: Use " tip-bot for Rasmus Villemoes
2015-10-11 20:15 ` tip-bot for Rasmus Villemoes

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®