[lttng-dev] [PATCH 3/3] rculfhash: remove duplicated code

Mathieu Desnoyers mathieu.desnoyers at efficios.com
Thu Jul 31 17:00:25 EDT 2014


Merged into master, stable-0.8, stable-0.7, thanks!

Mathieu

----- Original Message -----
> From: "Eric Wong" <normalperson at yhbt.net>
> To: lttng-dev at lists.lttng.org
> Cc: e at 80x24.org
> Sent: Monday, June 23, 2014 9:20:32 PM
> Subject: [lttng-dev] [PATCH 3/3] rculfhash: remove duplicated code
> 
> Signed-off-by: Eric Wong <normalperson at yhbt.net>
> ---
>  rculfhash.c | 19 ++++---------------
>  1 file changed, 4 insertions(+), 15 deletions(-)
> 
> diff --git a/rculfhash.c b/rculfhash.c
> index d534be2..61da37a 100644
> --- a/rculfhash.c
> +++ b/rculfhash.c
> @@ -1177,6 +1177,10 @@ void partition_resize_helper(struct cds_lfht *ht,
> unsigned long i,
>  	int thread, ret;
>  	unsigned long nr_threads;
>  
> +	assert(nr_cpus_mask != -1);
> +	if (nr_cpus_mask < 0 || len < 2 * MIN_PARTITION_PER_THREAD)
> +		goto fallback;
> +
>  	/*
>  	 * Note: nr_cpus_mask + 1 is always power of 2.
>  	 * We spawn just the number of threads we need to satisfy the minimum
> @@ -1270,13 +1274,6 @@ static
>  void init_table_populate(struct cds_lfht *ht, unsigned long i,
>  			 unsigned long len)
>  {
> -	assert(nr_cpus_mask != -1);
> -	if (nr_cpus_mask < 0 || len < 2 * MIN_PARTITION_PER_THREAD) {
> -		ht->flavor->thread_online();
> -		init_table_populate_partition(ht, i, 0, len);
> -		ht->flavor->thread_offline();
> -		return;
> -	}
>  	partition_resize_helper(ht, i, len, init_table_populate_partition);
>  }
>  
> @@ -1369,14 +1366,6 @@ void remove_table_partition(struct cds_lfht *ht,
> unsigned long i,
>  static
>  void remove_table(struct cds_lfht *ht, unsigned long i, unsigned long len)
>  {
> -
> -	assert(nr_cpus_mask != -1);
> -	if (nr_cpus_mask < 0 || len < 2 * MIN_PARTITION_PER_THREAD) {
> -		ht->flavor->thread_online();
> -		remove_table_partition(ht, i, 0, len);
> -		ht->flavor->thread_offline();
> -		return;
> -	}
>  	partition_resize_helper(ht, i, len, remove_table_partition);
>  }
>  
> --
> 2.0.0.259.gbf1bc9c
> 
> 
> _______________________________________________
> lttng-dev mailing list
> lttng-dev at lists.lttng.org
> http://lists.lttng.org/cgi-bin/mailman/listinfo/lttng-dev
> 

-- 
Mathieu Desnoyers
EfficiOS Inc.
http://www.efficios.com



More information about the lttng-dev mailing list