Re: [patch] 2.2.9_andrea-VM1.gz

Chuck Lever (cel@monkey.org)
Wed, 9 Jun 1999 15:26:35 -0400 (EDT)


On Tue, 8 Jun 1999, Peter Steiner wrote:
> Is the imul of a K6-2 faster than of a Pentium? I cannot find numbers in
> Intel's datasheets. The K6-2 needs 2-3 cycles for a multiplication which
> makes the hashfn very fast and efficient. If Intel is so much slower we
> really need a platform specific hashfn...
>
> If the problem really is the multiplication, my lightweight-hashfn should
> solve the problem:
>
> #define _hashfn(dev,block) \
> (((unsigned)((HASHDEV(dev)+block)+(block>>11))) & bh_hash_mask)
>
> It is not designed for best hash distribution. Instead it is designed to be
> L1/L2-cache friendly (and of course it avoids the multiplication). Try it
> with an average bucketsize of 4 or 2 (8 is too full). If this helps I'll
> dig deeper into that kind of hashfn.

as much as i like the multiplicative hash function, i think Linux should
go with Peter's shift-add function for these reasons:

1. it's simple

2. it works independent of the multiplication speed or word size of the
CPU, so we don't need an "architecture dependent" function

3. it works well enough

> At the moment the buffer cache doesn't like to grow much. In fact, it's hard
> to get it bigger than 7 MB and it's about 1.5 MB most of the time. Even the
> old hashfn should be able to put 1500 buffers into 65536 buckets...

it totally depends on the workload. i can get it to grow pretty large.

- Chuck Lever

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

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

- 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/