Re: [PATCH rdma-next 13/16] RDMA/restrack: Directly mark user/kernel entry in XArray

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

 



On Mon, Jan 14, 2019 at 04:18:22PM +0200, Leon Romanovsky wrote:
> From: Leon Romanovsky <leonro@xxxxxxxxxxxx>
> 
> Conversion to XArray allows us to mark specific entry with custom flags,
> in our case we need to distinguish between user vs. kernel entries, so drop
> custom boolean flag used before in favour of XAarray mark feature.

Marks are mainly helpful in the xarray if they are used as part of the
iteration with xa_for_each as they significantly reduce the overhead..

> +bool rdma_is_kernel_res(struct rdma_restrack_entry *res)
> +{
> +	struct ib_device *dev = res_to_dev(res);
> +	struct xarray *xa;
> +
> +	xa = rdma_dev_to_xa(dev, res->type);
> +
> +	return !xa_get_mark(xa, res_to_id(res), RES_USER_ENTRY);
> +}
> +EXPORT_SYMBOL(rdma_is_kernel_res);

This is now O(log(n)) to save an irrelevant amount of memory.

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