From patchwork Wed Apr 30 01:10:39 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Behan Webster X-Patchwork-Id: 29381 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-ob0-f197.google.com (mail-ob0-f197.google.com [209.85.214.197]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id 5B29C202FE for ; Wed, 30 Apr 2014 01:11:15 +0000 (UTC) Received: by mail-ob0-f197.google.com with SMTP id wp4sf5278820obc.0 for ; Tue, 29 Apr 2014 18:11:15 -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=RP604dsSTw1AN9f9hSWryvFtpMFjpAkSHTi+wYJxp+wjnX+fxeVRmnMO27vsJ9JJm/ rPv8me+kllQe1iJp/sBdvW8diOz7pdBZPnZtpiSYvCoBxlVHOmH6U+8iBqR4xgQgx+Gi bqZjS5Jf0YOGdX4F3bsv2aKIlhSMYmj9ku2dfl8D3qD2O7qhkJydI7w2Sm05XodpOPf1 VYZYwA2hcVH7pGMrmNslqYlRwCk0CU+ByBCNCibkKRp0/K5ID1q51bcqnJn9kXxCZdFI DbpbVUXMzElpH6iR/IUxxYcSJRw3uklZ7n2ULy7Kj/Y973h2rU/VaVYdEsFr1e3H8sqx 4+SQ== X-Gm-Message-State: ALoCoQk5J+i82ANcJwFY4PtCvImZ4Ib0FWWql3MlRQr4sjE7rXNPGNaW1cJvmZB893CC9h3oSYHd X-Received: by 10.42.39.210 with SMTP id i18mr602435ice.19.1398820275408; Tue, 29 Apr 2014 18:11:15 -0700 (PDT) MIME-Version: 1.0 X-BeenThere: patchwork-forward@linaro.org Received: by 10.140.93.131 with SMTP id d3ls392421qge.52.gmail; Tue, 29 Apr 2014 18:11:15 -0700 (PDT) X-Received: by 10.52.130.225 with SMTP id oh1mr871222vdb.8.1398820275274; Tue, 29 Apr 2014 18:11:15 -0700 (PDT) Received: from mail-vc0-x232.google.com (mail-vc0-x232.google.com [2607:f8b0:400c:c03::232]) by mx.google.com with ESMTPS id ck5si4967725vdd.73.2014.04.29.18.11.15 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Tue, 29 Apr 2014 18:11:15 -0700 (PDT) Received-SPF: none (google.com: patch+caf_=patchwork-forward=linaro.org@linaro.org does not designate permitted sender hosts) client-ip=2607:f8b0:400c:c03::232; Received: by mail-vc0-f178.google.com with SMTP id hu19so1355129vcb.9 for ; Tue, 29 Apr 2014 18:11:15 -0700 (PDT) X-Received: by 10.220.59.65 with SMTP id k1mr1022188vch.22.1398820275162; Tue, 29 Apr 2014 18:11:15 -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 ib8csp239638vcb; Tue, 29 Apr 2014 18:11:14 -0700 (PDT) X-Received: by 10.67.15.42 with SMTP id fl10mr2620123pad.30.1398820273507; Tue, 29 Apr 2014 18:11:13 -0700 (PDT) Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id to1si11190178pab.199.2014.04.29.18.11.11; Tue, 29 Apr 2014 18:11:11 -0700 (PDT) Received-SPF: none (google.com: linux-kernel-owner@vger.kernel.org does not designate permitted sender hosts) client-ip=209.132.180.67; Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752127AbaD3BLD (ORCPT + 28 others); Tue, 29 Apr 2014 21:11:03 -0400 Received: from mail-qg0-f42.google.com ([209.85.192.42]:44827 "EHLO mail-qg0-f42.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750861AbaD3BLA (ORCPT ); Tue, 29 Apr 2014 21:11:00 -0400 Received: by mail-qg0-f42.google.com with SMTP id z60so451589qgd.15 for ; Tue, 29 Apr 2014 18:10:59 -0700 (PDT) X-Received: by 10.224.97.69 with SMTP id k5mr1500893qan.8.1398820259724; Tue, 29 Apr 2014 18:10:59 -0700 (PDT) Received: from galdor.websterwood.com ([209.133.115.210]) by mx.google.com with ESMTPSA id s13sm42831716qag.19.2014.04.29.18.10.57 for (version=TLSv1.1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Tue, 29 Apr 2014 18:10:58 -0700 (PDT) From: behanw@converseincode.com To: viro@zeniv.linux.org.uk Cc: linux-fsdevel@vger.kernel.org, linux-kernel@vger.kernel.org, torvalds@linux-foundation.org, hpa@zytor.com, dwmw2@infradead.org, Mark Charlebois , Behan Webster Subject: [PATCH] mbcache: LLVMLinux: Remove double calculation from mbcache Date: Tue, 29 Apr 2014 18:10:39 -0700 Message-Id: <1398820239-1890-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: patch+caf_=patchwork-forward=linaro.org@linaro.org does not designate permitted sender hosts) 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))