From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751840AbbJBHpq (ORCPT ); Fri, 2 Oct 2015 03:45:46 -0400 Received: from mail-la0-f50.google.com ([209.85.215.50]:36024 "EHLO mail-la0-f50.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751210AbbJBHpm (ORCPT ); Fri, 2 Oct 2015 03:45:42 -0400 From: Rasmus Villemoes To: John Stultz , Thomas Gleixner Cc: Rasmus Villemoes , linux-kernel@vger.kernel.org Subject: [PATCH] kernel: time: timer.c: use __fls in apply_slack() Date: Fri, 2 Oct 2015 09:45:30 +0200 Message-Id: <1443771931-6284-1-git-send-email-linux@rasmusvillemoes.dk> X-Mailer: git-send-email 2.1.3 Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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 --- 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