[lttng-dev] [PATCH 6/7] Fix: uatomic_or() need retyping to uintptr_t in rculfhash.c

Mathieu Desnoyers mathieu.desnoyers at efficios.com
Mon Mar 20 14:31:03 EDT 2023


On 2023-03-17 17:37, Ondřej Surý via lttng-dev wrote:
> When adding REMOVED_FLAG to the pointers in the rculfhash
> implementation, retype the generic pointer to uintptr_t to fix the
> compiler error.

What is the compiler error ? I'm wondering whether the expected choice
to match the rest of this file's content would be to use "uintptr_t *" 
or "unsigned long *" ?

Thanks,

Mathieu

> 
> Signed-off-by: Ondřej Surý <ondrej at sury.org>
> ---
>   src/rculfhash.c | 4 ++--
>   1 file changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/src/rculfhash.c b/src/rculfhash.c
> index b456415..863387e 100644
> --- a/src/rculfhash.c
> +++ b/src/rculfhash.c
> @@ -1198,7 +1198,7 @@ int _cds_lfht_del(struct cds_lfht *ht, unsigned long size,
>   	 * Knowing which wins the race will be known after the garbage
>   	 * collection phase, stay tuned!
>   	 */
> -	uatomic_or(&node->next, REMOVED_FLAG);
> +	uatomic_or((uintptr_t *)&node->next, REMOVED_FLAG);
>   	/* We performed the (logical) deletion. */
>   
>   	/*
> @@ -1441,7 +1441,7 @@ void remove_table_partition(struct cds_lfht *ht, unsigned long i,
>   		dbg_printf("remove entry: order %lu index %lu hash %lu\n",
>   			   i, j, j);
>   		/* Set the REMOVED_FLAG to freeze the ->next for gc */
> -		uatomic_or(&fini_bucket->next, REMOVED_FLAG);
> +		uatomic_or((uintptr_t *)&fini_bucket->next, REMOVED_FLAG);
>   		_cds_lfht_gc_bucket(parent_bucket, fini_bucket);
>   	}
>   	ht->flavor->read_unlock();

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



More information about the lttng-dev mailing list