Re: [PATCH rdma-next v2 04/14] RDMA/restrack: Count references to the verbs objects

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

 



On Fri, Sep 18, 2020 at 02:00:20PM -0300, Jason Gunthorpe wrote:
> On Mon, Sep 07, 2020 at 03:21:46PM +0300, Leon Romanovsky wrote:
> > From: Leon Romanovsky <leonro@xxxxxxxxxxxx>
> >
> > Refactor the restrack code to make sure that kref inside restrack entry
> > properly kref the object in which it is embedded. This slight change is
> > needed for future conversions of MR and QP which are refcounted before
> > the release and kfree.
> >
> > The ideal flow from ib_core perspective as follows:
> > * Allocate ib_* structure with rdma_zalloc_*.
>
> Given how things are going it would be good to eventually include the
> kref initialization in the allocation:

Yep, this is the plan.

>
> struct rdma_restrack_entry *_rdma_zalloc_drv_obj_gfp(struct ib_device *ibdev,
> 						     size_t size,
> 						     size_t res_offset,
> 						     gfp_t flags);
> {
>     struct rdma_restrack_entry res = kzalloc(size, flags) + res_offset;
> [..]
>     return res;
> }
>
> #define rdma_zalloc_drv_obj_gfp(ib_dev, ib_type, gfp)                          \
> 	container_of(_rdma_zalloc_drv_obj_gfp(                                 \
> 			     ib_dev, (ib_dev)->ops.size_##ib_type,             \
> 			     offsetof(struct ib_type, res), gfp),              \
> 		     struct ib_type, res)
>
> As the idea is every drv_obj will have the kref
>
> The patch looks OK, the rdma_restrack_new calls are all near their
> matching allocations
>
> 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