Re: Hash functions (was Re: 2.2.6_andrea2.bz2)

Andrea Arcangeli (andrea@e-mind.com)
Mon, 10 May 1999 01:48:26 +0200 (CEST)


On Sun, 9 May 1999, Peter Steiner wrote:

>Andrea, may I reorder your questions?

Sure you're welcome ;).

>>And what is `hash'? The input of the hashfn of buffers are blocks and dev.
>
>Chuck tuned various hash functions, and only the buffer cache uses
>blocks and dev. hash is a generic substitution. In my description I
>used 'k' up to this point.

Ah ok. Fine. (I thought you was talking specifically about the buffer
hash)

>Since my hash table size is 16384 and thus (32 - HASH_BITS) = 18 the
>'normalized' hashfn is:
>
> i = ((k * 2654435761UL) >> 11) & bh_hash_mask
> = ((k * 2654435761UL) << ((32 - HASH_BITS) - 11)) >> (32 - HASH_BITS)

I don't think the above is correct. If you don't shift left for (32 -
HASH_BITS) at least at once, then you may have still some bit set to 1 in
the high part of `i'.

Andrea Arcangeli

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