All of lore.kernel.org
 help / color / mirror / Atom feed
From: Matthew Wilcox <matthew@wil.cx>
To: Liuweni <qingshenlwy@gmail.com>
Cc: linux-kernel <linux-kernel@vger.kernel.org>,
	viro <viro@zeniv.linux.org.uk>, akpm <akpm@linux-foundation.org>,
	jack <jack@suse.cz>, npiggin <npiggin@suse.de>,
	linux-fsdevel <linux-fsdevel@vger.kernel.org>,
	strongzgy <strongzgy@gmail.com>, xgr178 <xgr178@163.com>,
	Liu Hui <onlyflyer@gmail.com>
Subject: Re: [PATCH 2/3]fs/inode: iunique() Optimize Performance
Date: Wed, 25 Nov 2009 07:17:28 -0700	[thread overview]
Message-ID: <20091125141727.GI9482@parisc-linux.org> (raw)
In-Reply-To: <200911252212166092236@gmail.com>

On Wed, Nov 25, 2009 at 10:12:19PM +0800, Liuweni wrote:
> @@ -605,8 +605,8 @@ static unsigned long hash(struct super_block *sb, unsigned long hashval)
>  {
>  	unsigned long tmp;
>  
> -	tmp = (hashval * (unsigned long)sb) ^ (GOLDEN_RATIO_PRIME + hashval) /
> -			L1_CACHE_BYTES;
> +	tmp = (hashval * (unsigned long)sb) ^ (GOLDEN_RATIO_PRIME + hashval) >>
> +			L1_CACHE_SHIFT;
>  	tmp = tmp ^ ((tmp ^ GOLDEN_RATIO_PRIME) >> I_HASHBITS);
>  	return tmp & I_HASHMASK;
>  }

Have you compared the compiler output before/after your change?  I'd be
amazed if GCC isn't able to optimise division-by-a-constant-power-of-two
into shift-by-constant.

-- 
Matthew Wilcox				Intel Open Source Technology Centre
"Bill, look, we understand that you're interested in selling us this
operating system, but compare it to ours.  We can't possibly take such
a retrograde step."

  reply	other threads:[~2009-11-25 14:17 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-11-25 14:12 [PATCH 2/3]fs/inode: iunique() Optimize Performance Liuweni
2009-11-25 14:17 ` Matthew Wilcox [this message]
2009-11-25 14:45   ` Américo Wang

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=20091125141727.GI9482@parisc-linux.org \
    --to=matthew@wil.cx \
    --cc=akpm@linux-foundation.org \
    --cc=jack@suse.cz \
    --cc=linux-fsdevel@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=npiggin@suse.de \
    --cc=onlyflyer@gmail.com \
    --cc=qingshenlwy@gmail.com \
    --cc=strongzgy@gmail.com \
    --cc=viro@zeniv.linux.org.uk \
    --cc=xgr178@163.com \
    /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.