From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752380AbbJKUKK (ORCPT ); Sun, 11 Oct 2015 16:10:10 -0400 Received: from terminus.zytor.com ([198.137.202.10]:33301 "EHLO terminus.zytor.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751999AbbJKUKI (ORCPT ); Sun, 11 Oct 2015 16:10:08 -0400 Date: Sun, 11 Oct 2015 13:09:56 -0700 From: tip-bot for Rasmus Villemoes Message-ID: Cc: tglx@linutronix.de, mingo@kernel.org, linux@rasmusvillemoes.dk, linux-kernel@vger.kernel.org, hpa@zytor.com, john.stultz@linaro.org Reply-To: hpa@zytor.com, john.stultz@linaro.org, mingo@kernel.org, tglx@linutronix.de, linux@rasmusvillemoes.dk, linux-kernel@vger.kernel.org In-Reply-To: <1443771931-6284-1-git-send-email-linux@rasmusvillemoes.dk> References: <1443771931-6284-1-git-send-email-linux@rasmusvillemoes.dk> To: linux-tip-commits@vger.kernel.org Subject: [tip:timers/core] timers: Use __fls in apply_slack() Git-Commit-ID: 3e17510cbc3e75cae0c96fa38ca469ffe754aedf X-Mailer: tip-git-log-daemon Robot-ID: Robot-Unsubscribe: Contact to get blacklisted from these emails MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Content-Type: text/plain; charset=UTF-8 Content-Disposition: inline Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Commit-ID: 3e17510cbc3e75cae0c96fa38ca469ffe754aedf Gitweb: http://git.kernel.org/tip/3e17510cbc3e75cae0c96fa38ca469ffe754aedf Author: Rasmus Villemoes AuthorDate: Fri, 2 Oct 2015 09:45:30 +0200 Committer: Thomas Gleixner 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 Cc: John Stultz Link: http://lkml.kernel.org/r/1443771931-6284-1-git-send-email-linux@rasmusvillemoes.dk Signed-off-by: Thomas Gleixner --- 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;