lkml.org 
[lkml]   [1999]   [Apr]   [16]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: random table-driven hash benchmarked
On Fri, 16 Apr 1999, Andrea Arcangeli wrote:
> >/* this is 40499 * 65543 - both are prime; the result is ~0.68*(2^32) */
> >#define MULTIPLIER 2654425957UL
> >
> >#define _hashfn(dev,block) \
> > ((((unsigned long) (block) * MULTIPLIER) >> 11) & bh_hash_mask)
>
> Personally I like this mul hashfn. But your implementation doesn't use dev
> information. Is that intentional?

yes. i reasoned that the dev parameter isn't really adding any useful
randomness, so i left it out of my original function. i've done a few
benchmarks to test the hypothesis, and, by-and-large, the hash functions
without "dev" seemed to work a little better.

if you want to add it back, i suggest this:

((((unsigned long) (minor(dev) + (block)) * MULTIPLIER) >> 11) &
bh_hash_mask)

- Chuck Lever
--
corporate: <chuckl@netscape.com>
personal: <chucklever@netscape.net> or <cel@monkey.org>

The Linux Scalability project:
http://www.citi.umich.edu/projects/citi-netscape/


-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.rutgers.edu
Please read the FAQ at http://www.tux.org/lkml/

\
 
 \ /
  Last update: 2005-03-22 13:51    [W:0.094 / U:1.064 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site