From 6aa56943018c56d09f771446674c7b5fd8454e8d Mon Sep 17 00:00:00 2001 From: Isaac Huang Date: Mon, 13 Sep 2010 10:43:48 -0600 Subject: [PATCH] b=23179 MDS node unresponsive Better hash distribution, doubled hash size for the lnet cookie hash. i=zhen.liang i=andreas.dilger --- lnet/include/lnet/lib-types.h | 3 ++- lnet/lnet/api-ni.c | 6 +++--- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/lnet/include/lnet/lib-types.h b/lnet/include/lnet/lib-types.h index eba85da..92b1295 100644 --- a/lnet/include/lnet/lib-types.h +++ b/lnet/include/lnet/lib-types.h @@ -304,7 +304,8 @@ typedef struct { #define LNET_COOKIE_TYPE_MD 1 #define LNET_COOKIE_TYPE_ME 2 #define LNET_COOKIE_TYPE_EQ 3 -#define LNET_COOKIE_TYPES 4 +#define LNET_COOKIE_TYPE_BITS 2 +#define LNET_COOKIE_TYPES (1 << LNET_COOKIE_TYPE_BITS) /* LNET_COOKIE_TYPES must be a power of 2, so the cookie type can be * extracted by masking with (LNET_COOKIE_TYPES - 1) */ diff --git a/lnet/lnet/api-ni.c b/lnet/lnet/api-ni.c index 37f15be..657568f 100644 --- a/lnet/lnet/api-ni.c +++ b/lnet/lnet/api-ni.c @@ -513,7 +513,7 @@ lnet_setup_handle_hash (void) /* Arbitrary choice of hash table size */ #ifdef __KERNEL__ - the_lnet.ln_lh_hash_size = CFS_PAGE_SIZE / sizeof (struct list_head); + the_lnet.ln_lh_hash_size = (2 * CFS_PAGE_SIZE) / sizeof (struct list_head); #else the_lnet.ln_lh_hash_size = (MAX_MES + MAX_MDS + MAX_EQS)/4; #endif @@ -551,7 +551,7 @@ lnet_lookup_cookie (__u64 cookie, int type) if ((cookie & (LNET_COOKIE_TYPES - 1)) != type) return (NULL); - hash = ((unsigned int)cookie) % the_lnet.ln_lh_hash_size; + hash = ((unsigned int)(cookie >> LNET_COOKIE_TYPE_BITS)) % the_lnet.ln_lh_hash_size; list = &the_lnet.ln_lh_hash_table[hash]; list_for_each (el, list) { @@ -575,7 +575,7 @@ lnet_initialise_handle (lnet_libhandle_t *lh, int type) lh->lh_cookie = the_lnet.ln_next_object_cookie | type; the_lnet.ln_next_object_cookie += LNET_COOKIE_TYPES; - hash = ((unsigned int)lh->lh_cookie) % the_lnet.ln_lh_hash_size; + hash = ((unsigned int)(lh->lh_cookie >> LNET_COOKIE_TYPE_BITS)) % the_lnet.ln_lh_hash_size; list_add (&lh->lh_hash_chain, &the_lnet.ln_lh_hash_table[hash]); } -- 1.8.3.1