From patchwork Tue Apr 22 05:19:53 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Behan Webster X-Patchwork-Id: 28760 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-ig0-f197.google.com (mail-ig0-f197.google.com [209.85.213.197]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id B7A612032B for ; Tue, 22 Apr 2014 05:20:46 +0000 (UTC) Received: by mail-ig0-f197.google.com with SMTP id hn18sf10248317igb.0 for ; Mon, 21 Apr 2014 22:20:46 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:mime-version:delivered-to:from:to:cc:subject :date:message-id:sender:precedence:list-id:x-original-sender :x-original-authentication-results:mailing-list:list-post:list-help :list-archive:list-unsubscribe; bh=ZG4ONQq1cX1SHyBj5CMVYVGECymb53u+ED4o8zYxW0E=; b=i9UQnSWeaIbG9aY2AYdBoDmIzIXXOiSQCgeGNUz/LvMDE6L8Mmy/IaQTJd7i2y75nr PXMNmXJXhsjbwu6ObvWrhvwIhWntLIyjZJSYccUePTgUq2hk33Jt+MbqmzI+zeUgGtKu Iij1adlD+C8IUAH7zK+gcdwSjWeSkObuTqA3cft4dGvx3O50xabQgaPDZE5fqQLUvxrj 0qUbO86npWZDRLD0EiYNfX4XiwwWAZGu4HeXUTCxmd+Nrl4v0wxYjQCDMsWz5xSVNuDH sFXqmolFyuF+scpThdh8QwanoYzykugPHgF0IB6KbtsX5NgWTbdWJ0LraFKo0JjM7EeY ZzYg== X-Gm-Message-State: ALoCoQl4lLf3nsgHzTr2Pcxk/OcvfouYrhZoESUcwsG4UpgfX7DPlU3u/+wzfDGWPhjUZRCCyqAn X-Received: by 10.182.4.76 with SMTP id i12mr20876303obi.33.1398144045977; Mon, 21 Apr 2014 22:20:45 -0700 (PDT) MIME-Version: 1.0 X-BeenThere: patchwork-forward@linaro.org Received: by 10.140.23.106 with SMTP id 97ls2780336qgo.34.gmail; Mon, 21 Apr 2014 22:20:45 -0700 (PDT) X-Received: by 10.58.74.38 with SMTP id q6mr37195047vev.7.1398144045744; Mon, 21 Apr 2014 22:20:45 -0700 (PDT) Received: from mail-ve0-x229.google.com (mail-ve0-x229.google.com [2607:f8b0:400c:c01::229]) by mx.google.com with ESMTPS id z6si6688920vcm.9.2014.04.21.22.20.45 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Mon, 21 Apr 2014 22:20:45 -0700 (PDT) Received-SPF: neutral (google.com: 2607:f8b0:400c:c01::229 is neither permitted nor denied by best guess record for domain of patch+caf_=patchwork-forward=linaro.org@linaro.org) client-ip=2607:f8b0:400c:c01::229; Received: by mail-ve0-f169.google.com with SMTP id pa12so9266966veb.0 for ; Mon, 21 Apr 2014 22:20:45 -0700 (PDT) X-Received: by 10.58.13.104 with SMTP id g8mr34030893vec.16.1398144045651; Mon, 21 Apr 2014 22:20:45 -0700 (PDT) X-Forwarded-To: patchwork-forward@linaro.org X-Forwarded-For: patch@linaro.org patchwork-forward@linaro.org Delivered-To: patch@linaro.org Received: by 10.220.221.72 with SMTP id ib8csp343112vcb; Mon, 21 Apr 2014 22:20:44 -0700 (PDT) X-Received: by 10.67.3.132 with SMTP id bw4mr36148911pad.54.1398144044623; Mon, 21 Apr 2014 22:20:44 -0700 (PDT) Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id et3si22059131pbc.291.2014.04.21.22.20.44; Mon, 21 Apr 2014 22:20:44 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751966AbaDVFU3 (ORCPT + 26 others); Tue, 22 Apr 2014 01:20:29 -0400 Received: from mail-ob0-f177.google.com ([209.85.214.177]:46928 "EHLO mail-ob0-f177.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751376AbaDVFUB (ORCPT ); Tue, 22 Apr 2014 01:20:01 -0400 Received: by mail-ob0-f177.google.com with SMTP id wp18so5056934obc.36 for ; Mon, 21 Apr 2014 22:20:00 -0700 (PDT) X-Received: by 10.60.15.38 with SMTP id u6mr35059801oec.26.1398144000427; Mon, 21 Apr 2014 22:20:00 -0700 (PDT) Received: from galdor.hil-sanbegi.snd.wayport.net (ip-64-134-224-141.public.wayport.net. [64.134.224.141]) by mx.google.com with ESMTPSA id j9sm74671485obh.23.2014.04.21.22.19.58 for (version=TLSv1.1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Mon, 21 Apr 2014 22:19:59 -0700 (PDT) From: behanw@converseincode.com To: viro@zeniv.linux.org.uk Cc: linux-fsdevel@vger.kernel.org, linux-kernel@vger.kernel.org, dwmw2@infradead.org, pageexec@freemail.hu, Mark Charlebois , Behan Webster Subject: [PATCH] mbcache: LLVMLinux: Remove double calculation from mbcache Date: Mon, 21 Apr 2014 22:19:53 -0700 Message-Id: <1398143993-19206-1-git-send-email-behanw@converseincode.com> X-Mailer: git-send-email 1.8.3.2 Sender: linux-kernel-owner@vger.kernel.org Precedence: list List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-Original-Sender: behanw@converseincode.com X-Original-Authentication-Results: mx.google.com; spf=neutral (google.com: 2607:f8b0:400c:c01::229 is neither permitted nor denied by best guess record for domain of patch+caf_=patchwork-forward=linaro.org@linaro.org) smtp.mail=patch+caf_=patchwork-forward=linaro.org@linaro.org; dkim=neutral (body hash did not verify) header.i=@converseincode.com Mailing-list: list patchwork-forward@linaro.org; contact patchwork-forward+owners@linaro.org X-Google-Group-Id: 836684582541 List-Post: , List-Help: , List-Archive: List-Unsubscribe: , From: Mark Charlebois The call to __builtin_log2 presumes there is a double log2(double x) function defined in the kernel. The call to hash_log is a call to hash_64 which is defined in include/linux/hash.h static __always_inline u64 hash_64(u64 val, unsigned int bits) That means that __builtin_log2(NR_BG_LOCKS) is converting NR_BG_LOCKS to a double and returning a double and then that is converted to an unsigned int. Using ilog2 is much more appropriate and efficient. Another side effect of using __builtin_log2 is that is uses __aeabi_* functions for ARM that require linking with libgcc.a. Author: Mark Charlebois Signed-off-by: Mark Charlebois Signed-off-by: Behan Webster --- fs/mbcache.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/fs/mbcache.c b/fs/mbcache.c index bf166e3..2c0752b 100644 --- a/fs/mbcache.c +++ b/fs/mbcache.c @@ -93,7 +93,7 @@ #define MB_CACHE_WRITER ((unsigned short)~0U >> 1) -#define MB_CACHE_ENTRY_LOCK_BITS __builtin_log2(NR_BG_LOCKS) +#define MB_CACHE_ENTRY_LOCK_BITS ilog2(NR_BG_LOCKS) #define MB_CACHE_ENTRY_LOCK_INDEX(ce) \ (hash_long((unsigned long)ce, MB_CACHE_ENTRY_LOCK_BITS))