From: "Américo Wang" <xiyou.wangcong@gmail.com>
To: Matthew Wilcox <matthew@wil.cx>
Cc: Liuweni <qingshenlwy@gmail.com>,
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 22:45:39 +0800 [thread overview]
Message-ID: <20091125144539.GA3520@hack> (raw)
In-Reply-To: <20091125141727.GI9482@parisc-linux.org>
On Wed, Nov 25, 2009 at 07:17:28AM -0700, Matthew Wilcox wrote:
>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.
If a compiler can't do this nowadays, I'd consider it's a bug.
--
Live like a child, think like the god.
prev parent reply other threads:[~2009-11-25 14:44 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
2009-11-25 14:45 ` Américo Wang [this message]
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=20091125144539.GA3520@hack \
--to=xiyou.wangcong@gmail.com \
--cc=akpm@linux-foundation.org \
--cc=jack@suse.cz \
--cc=linux-fsdevel@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=matthew@wil.cx \
--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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).