From: "Jose R. Santos" <jrsantos@austin.ibm.com>
To: "Jose R. Santos" <jrsantos@austin.ibm.com>
Cc: Andrew Morton <akpm@osdl.org>,
"Jose R. Santos" <jrsantos@austin.ibm.com>,
linux-kernel@vger.kernel.org, anton@samba.org, dheger@us.ibm.com
Subject: Re: [PATCH] dentry and inode cache hash algorithm performance changes.
Date: Fri, 30 Apr 2004 16:33:24 -0500 [thread overview]
Message-ID: <20040430213324.GK14271@rx8.ibm.com> (raw)
In-Reply-To: <20040430205701.GG14271@rx8.ibm.com> (from jrsantos@austin.ibm.com on Fri, Apr 30, 2004 at 15:57:01 -0500)
On 04/30/04 15:57:01, Jose R. Santos wrote:
> err... Wrote the patch to fast. It should read
>
> tmp = (hashval * sb) ^ (GOLDEN_RATIO_PRIME + hashval) / L1_CACHE_BYTES
>
> I screw up... I'll send a fixed patch in a while.
Just notice I've made another error in the inode hash code.
Fixed patch (I hope) with beautification.
-JRS
diff -Nru a/fs/dcache.c b/fs/dcache.c
--- a/fs/dcache.c Fri Apr 30 16:27:41 2004
+++ b/fs/dcache.c Fri Apr 30 16:27:41 2004
@@ -28,6 +28,7 @@
#include <asm/uaccess.h>
#include <linux/security.h>
#include <linux/seqlock.h>
+#include <linux/hash.h>
#define DCACHE_PARANOIA 1
/* #define DCACHE_DEBUG 1 */
@@ -799,8 +800,8 @@
static inline struct hlist_head * d_hash(struct dentry * parent, unsigned long hash)
{
- hash += (unsigned long) parent / L1_CACHE_BYTES;
- hash = hash ^ (hash >> D_HASHBITS);
+ hash += ((unsigned long) parent ^ GOLDEN_RATIO_PRIME) / L1_CACHE_BYTES;
+ hash = hash ^ ((hash ^ GOLDEN_RATIO_PRIME) >> D_HASHBITS);
return dentry_hashtable + (hash & D_HASHMASK);
}
diff -Nru a/fs/inode.c b/fs/inode.c
--- a/fs/inode.c Fri Apr 30 16:27:41 2004
+++ b/fs/inode.c Fri Apr 30 16:27:41 2004
@@ -671,12 +671,13 @@
static inline unsigned long hash(struct super_block *sb, unsigned long hashval)
{
- unsigned long tmp = hashval + ((unsigned long) sb / L1_CACHE_BYTES);
- tmp = tmp + (tmp >> I_HASHBITS);
+ unsigned long tmp;
+
+ tmp = (hashval * (unsigned long)sb) ^ (GOLDEN_RATIO_PRIME + hashval) /
+ L1_CACHE_BYTES;
+ tmp = tmp ^ ((tmp ^ GOLDEN_RATIO_PRIME) >> I_HASHBITS);
return tmp & I_HASHMASK;
}
-
-/* Yeah, I know about quadratic hash. Maybe, later. */
/**
* iunique - get a unique inode number
next prev parent reply other threads:[~2004-04-30 21:34 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <20040430191539.GC14271@rx8.ibm.com>
[not found] ` <20040430131832.45be6956.akpm@osdl.org>
2004-04-30 20:57 ` [PATCH] dentry and inode cache hash algorithm performance changes Jose R. Santos
2004-04-30 21:33 ` Jose R. Santos [this message]
2004-04-30 22:02 ` Andrew Morton
2004-04-30 23:42 ` Jose R. Santos
2004-05-04 13:12 ` Jose R. Santos
2004-05-04 18:55 ` Andrew Morton
2004-05-07 13:04 ` Jose R. Santos
2004-05-08 1:03 ` Dave Hansen
2004-04-30 19:55 Jose R. Santos
2004-05-01 12:08 ` Olaf Dietsche
2004-05-01 15:08 ` Jose R. Santos
2004-05-20 13:34 ` Raghavan
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=20040430213324.GK14271@rx8.ibm.com \
--to=jrsantos@austin.ibm.com \
--cc=akpm@osdl.org \
--cc=anton@samba.org \
--cc=dheger@us.ibm.com \
--cc=linux-kernel@vger.kernel.org \
/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.