From: "Quim K Holland" <qkholland@my-deja.com>
To: linux-kernel@vger.kernel.org
Cc: jukka.santala@kolumbus.fi
Subject: Re: 2.4.X inode cache bug
Date: Tue, 30 Jan 2001 23:01:49 -0800 [thread overview]
Message-ID: <200101310701.XAA05732@mail2.bigmailbox.com> (raw)
[-- Attachment #1: Type: text/plain, Size: 878 bytes --]
In <200101310202.EAA11357@smtp2.kolumbus.fi>, jukka.santala@kolumbus.fi
writes:
> Excuse me for the lack of patch in this mail,...
> In 2.4.x, linux/fs/inode.c has a hash() function with a small
> slip-up. The inode hash-value is initialized with "unsigned
> long tmp = i_ino | ((unsigned long) sb / L1_CACHE_BYTES);".
> ... I believe this is a
> slip-up, because you should NEVER use bitwise-or in a hash
> formula. This creates a slanted distribution, and depending on
> the address of the superblock block, can cause severe
> inefficiency in the code.
> Just replacing the | with ^ imroves hash-table efficiency
> noticeably,...
Then maybe the attached patch is what you want? This also replaces
`+' on the next line with `^' to avoid slanted distribution.
------------------------------------------------------------
--== Sent via Deja.com ==--
http://www.deja.com/
[-- Attachment #2: jukka.patch --]
[-- Type: application/octet-stream, Size: 482 bytes --]
--- 2.4.1/fs/inode.c Mon Jan 15 18:20:14 2001
+++ 2.4.1/fs/inode.c Tue Jan 30 22:54:42 2001
@@ -728,8 +728,8 @@
static inline unsigned long hash(struct super_block *sb, unsigned long i_ino)
{
- unsigned long tmp = i_ino | ((unsigned long) sb / L1_CACHE_BYTES);
- tmp = tmp + (tmp >> I_HASHBITS) + (tmp >> I_HASHBITS*2);
+ unsigned long tmp = i_ino ^ ((unsigned long) sb / L1_CACHE_BYTES);
+ tmp = tmp ^ (tmp >> I_HASHBITS) ^ (tmp >> I_HASHBITS*2);
return tmp & I_HASHMASK;
}
next reply other threads:[~2001-01-31 7:02 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2001-01-31 7:01 Quim K Holland [this message]
-- strict thread matches above, loose matches on Subject: below --
2001-01-31 2:10 jukka.santala
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=200101310701.XAA05732@mail2.bigmailbox.com \
--to=qkholland@my-deja.com \
--cc=jukka.santala@kolumbus.fi \
--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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®