Re: [PATCH for-next v6 1/8] RDMA/rxe: Replace RB tree by xarray for indexes

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Mon, Dec 06, 2021 at 03:12:36PM -0600, Bob Pearson wrote:
>  	if (pool->flags & RXE_POOL_INDEX) {
> -		pool->index.tree = RB_ROOT;
> -		err = rxe_pool_init_index(pool, info->max_index,
> -					  info->min_index);
> -		if (err)
> -			goto out;
> +		xa_init_flags(&pool->xarray.xa, XA_FLAGS_ALLOC);
> +		pool->xarray.limit.max = info->max_index;
> +		pool->xarray.limit.min = info->min_index;
> +	} else {
> +		/* if pool not indexed just use xa spin_lock */
> +		spin_lock_init(&pool->xarray.xa.xa_lock);

xarray's don't cost anything to init, so there is no reason to do
something like this.

> +/* drop a reference to an object */
> +static inline bool __rxe_drop_ref(struct rxe_pool_elem *elem)
> +{
> +	bool ret;
> +
> +	rxe_pool_lock_bh(elem->pool);
> +	ret = kref_put(&elem->ref_cnt, rxe_elem_release);
> +	rxe_pool_unlock_bh(elem->pool);

This is a bit strange, why does something need to hold a lock around a
kref?

Jason



[Index of Archives]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Photo]     [Yosemite News]     [Yosemite Photos]     [Linux Kernel]     [Linux SCSI]     [XFree86]

  Powered by Linux