[OpenAFS-devel] rx peer hashing sucks.

John S. Bucy bucy-openafs-devel@gloop.org
Mon, 20 Sep 2004 13:22:04 -0400


On Sun, Sep 19, 2004 at 10:42:17PM -0400, Derrick J Brashear wrote:
> I was debugging an error we had in 2 fileservers over 5 days (having never 
> seen the error before) and started delving into the rx_peerHashTable. 
> There are a lot of unused buckets. One bucket (155) has a huge number of 
> entries. It's a little-endian host. Most of the clients are in the same 
> class B network block. The hash is:
> 
> #define PEER_HASH(host, port)  ((host ^ port) & rx_hashTableMask)
> 
> Can you see where I'm going with this?
> 
> So in theory we want to hash quickly, so is using a bitshift in the peer 
> hash for little-endian only reasonable?

Isn't this the same demux that a TCP stack does?  

Linux 2.6 has

net/ipv4/tcp_ipv4.c:

static __inline__ int tcp_hashfn(__u32 laddr, __u16 lport,
                                 __u32 faddr, __u16 fport)
{
        int h = (laddr ^ lport) ^ (faddr ^ fport);
        h ^= h >> 16;
        h ^= h >> 8;
        return h & (tcp_ehash_size - 1);
}


The initization of tcp_ehash_size is tcp_init() in net/ipv4/tcp.c and
is a little messy since its tuned to num_physpages.




john