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 Tue, Jan 15, 2019 at 02:25:11PM +0200, Leon Romanovsky wrote:
> On Mon, Jan 14, 2019 at 08:37:55PM +0000, Jason Gunthorpe wrote:
> > 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.
> 
> Yes, now it takes 3 bits which anyway were allocated as part of xa_state
> handling. Before we had O(k) in memory footprint, while "k" is number of all
> objects and "n" is number of valid objects only.

If memory is the issue here the optimize the packing of the restrack
entry, I don't see a good reason to use marks for this..

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