From: Nickolai Zeldovich Date: Mon, 31 Jan 2005 04:20:25 +0000 (+0000) Subject: STABLE14-rx-hash-table-mod-prime-20050121 X-Git-Tag: openafs-devel-1_3_78~18 X-Git-Url: https://git.michaelhowe.org/gitweb/?a=commitdiff_plain;h=4240eeb48ac04fe9b62b4bc6284eb91fe079b9e0;p=packages%2Fo%2Fopenafs.git STABLE14-rx-hash-table-mod-prime-20050121 see https://lists.openafs.org/pipermail/openafs-devel/2004-September/010967.htmland https://lists.openafs.org/pipermail/openafs-devel/2004-September/010968.html (cherry picked from commit 01aca8ca222373d71941cd007bdc00260bd3ff5c) --- diff --git a/src/rx/rx_globals.h b/src/rx/rx_globals.h index b47f4a8a1..48774f00f 100644 --- a/src/rx/rx_globals.h +++ b/src/rx/rx_globals.h @@ -249,16 +249,15 @@ EXT struct rx_stats rx_stats; EXT struct rx_peer **rx_peerHashTable; EXT struct rx_connection **rx_connHashTable; EXT struct rx_connection *rx_connCleanup_list INIT(0); -EXT afs_uint32 rx_hashTableSize INIT(256); /* Power of 2 */ -EXT afs_uint32 rx_hashTableMask INIT(255); /* One less than rx_hashTableSize */ +EXT afs_uint32 rx_hashTableSize INIT(257); /* Prime number */ #ifdef RX_ENABLE_LOCKS EXT afs_kmutex_t rx_peerHashTable_lock; EXT afs_kmutex_t rx_connHashTable_lock; #endif /* RX_ENABLE_LOCKS */ -#define CONN_HASH(host, port, cid, epoch, type) ((((cid)>>RX_CIDSHIFT)&rx_hashTableMask)) +#define CONN_HASH(host, port, cid, epoch, type) ((((cid)>>RX_CIDSHIFT)%rx_hashTableSize)) -#define PEER_HASH(host, port) ((host ^ port) & rx_hashTableMask) +#define PEER_HASH(host, port) ((host ^ port) % rx_hashTableSize) /* Forward definitions of internal procedures */ #define rxi_ChallengeOff(conn) rxevent_Cancel((conn)->challengeEvent, (struct rx_call*)0, 0);