[ltt-dev] [PATCH 07/11] directly lookup bucket in the first order table

Mathieu Desnoyers mathieu.desnoyers at efficios.com
Thu Oct 27 00:55:02 EDT 2011


* Lai Jiangshan (laijs at cn.fujitsu.com) wrote:
> Signed-off-by: Lai Jiangshan <laijs at cn.fujitsu.com>

makes sense, will need to be applied after patch 06 though. Please
re-send after making MIN_ALLOC_SIZE a parameter to cds_lfht_new.

Thanks !

Mathieu

> ---
>  rculfhash.c |    8 ++++++--
>  1 files changed, 6 insertions(+), 2 deletions(-)
> 
> diff --git a/rculfhash.c b/rculfhash.c
> index 4ec59f9..1ccab8e 100644
> --- a/rculfhash.c
> +++ b/rculfhash.c
> @@ -719,12 +719,16 @@ struct _cds_lfht_node *lookup_bucket(struct cds_lfht *ht, unsigned long size,
>  
>  	assert(size > 0);
>  	index = hash & (size - 1);
> +
> +	if (index < MIN_ALLOC_SIZE)
> +		return &ht->t.tbl[0]->nodes[index];
> +
>  	order = fls_ulong(index);
>  
>  	dbg_printf("lookup hash %lu index %lu order %lu aridx %lu\n",
> -		   hash, index, order, index & (!order ? 0 : ((1UL << (order - 1)) - 1)));
> +		   hash, index, order, index & ((1UL << (order - 1)) - 1));
>  
> -	return &ht->t.tbl[order]->nodes[index & (!order ? 0 : ((1UL << (order - 1)) - 1))];
> +	return &ht->t.tbl[order]->nodes[index & ((1UL << (order - 1)) - 1)];
>  }
>  
>  /*
> -- 
> 1.7.4.4
> 

-- 
Mathieu Desnoyers
Operating System Efficiency R&D Consultant
EfficiOS Inc.
http://www.efficios.com




More information about the lttng-dev mailing list