[ltt-dev] [PATCH 5/9] rculfhash: avoid unneed garbage collect

Mathieu Desnoyers mathieu.desnoyers at efficios.com
Fri Oct 14 10:13:25 EDT 2011


* Lai Jiangshan (laijs at cn.fujitsu.com) wrote:
> Signed-off-by: Lai Jiangshan <laijs at cn.fujitsu.com>
> ---
>  rculfhash.c |    8 ++------
>  1 files changed, 2 insertions(+), 6 deletions(-)
> 
> diff --git a/rculfhash.c b/rculfhash.c
> index 1c859ed..f901ded 100644
> --- a/rculfhash.c
> +++ b/rculfhash.c
> @@ -850,7 +850,7 @@ struct cds_lfht_node *_cds_lfht_add(struct cds_lfht *ht,
>  				enum add_mode mode, int dummy)
>  {
>  	struct cds_lfht_node *iter_prev, *iter, *next, *new_node, *new_next,
> -			*dummy_node, *return_node;
> +			*return_node;
>  	struct _cds_lfht_node *lookup;
>  
>  	assert(!is_dummy(node));
> @@ -919,7 +919,7 @@ struct cds_lfht_node *_cds_lfht_add(struct cds_lfht *ht,
>  				return_node = NULL;
>  			else	/* ADD_DEFAULT and ADD_UNIQUE */
>  				return_node = node;
> -			goto gc_end;
> +			goto end;
>  		}
>  
>  	replace:
> @@ -941,10 +941,6 @@ struct cds_lfht_node *_cds_lfht_add(struct cds_lfht *ht,
>  		(void) uatomic_cmpxchg(&iter_prev->p.next, iter, new_next);
>  		/* retry */
>  	}
> -gc_end:
> -	/* Garbage collect logically removed nodes in the bucket */
> -	dummy_node = (struct cds_lfht_node *) lookup;
> -	_cds_lfht_gc_bucket(dummy_node, node);

See my comment in reply to the previous patch which explains that this
gc_end is needed to deal with concurrent removals+resizes.

Thanks,

Mathieu

>  end:
>  	return return_node;
>  }
> -- 
> 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