All of lore.kernel.org
 help / color / mirror / Atom feed
From: tip-bot for Rasmus Villemoes <tipbot@zytor.com>
To: linux-tip-commits@vger.kernel.org
Cc: tglx@linutronix.de, mingo@kernel.org, linux@rasmusvillemoes.dk,
	linux-kernel@vger.kernel.org, hpa@zytor.com,
	john.stultz@linaro.org
Subject: [tip:timers/core] timers: Use __fls in apply_slack()
Date: Sun, 11 Oct 2015 13:09:56 -0700	[thread overview]
Message-ID: <tip-3e17510cbc3e75cae0c96fa38ca469ffe754aedf@git.kernel.org> (raw)
In-Reply-To: <1443771931-6284-1-git-send-email-linux@rasmusvillemoes.dk>

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;
 

  reply	other threads:[~2015-10-11 20:10 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
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 [this message]
2015-10-11 20:15 ` [tip:timers/core] timers: Use " tip-bot for Rasmus Villemoes

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=tip-3e17510cbc3e75cae0c96fa38ca469ffe754aedf@git.kernel.org \
    --to=tipbot@zytor.com \
    --cc=hpa@zytor.com \
    --cc=john.stultz@linaro.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-tip-commits@vger.kernel.org \
    --cc=linux@rasmusvillemoes.dk \
    --cc=mingo@kernel.org \
    --cc=tglx@linutronix.de \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.