Re: [PATCH rdma-next 8/9] RDMA: Globally allocate and release QP memory

From: Leon Romanovsky
Date: Tue Jul 20 2021 - 04:37:30 EST


On Mon, Jul 19, 2021 at 04:42:11PM +0300, Gal Pressman wrote:
> On 18/07/2021 15:00, Leon Romanovsky wrote:
> > From: Leon Romanovsky <leonro@xxxxxxxxxx>
> >
> > Convert QP object to follow IB/core general allocation scheme.
> > That change allows us to make sure that restrack properly kref
> > the memory.
> >
> > Signed-off-by: Leon Romanovsky <leonro@xxxxxxxxxx>
>
> EFA and core parts look good to me.
> Reviewed-by: Gal Pressman <galpress@xxxxxxxxxx>
> Tested-by: Gal Pressman <galpress@xxxxxxxxxx>

Thanks a lot.

>
> > +static inline void *rdma_zalloc_obj(struct ib_device *dev, size_t size,
> > + gfp_t gfp, bool is_numa_aware)
> > +{
> > + if (is_numa_aware && dev->ops.get_numa_node)
>
> Honestly I think it's better to return an error if a numa aware allocation is
> requested and get_numa_node is not provided.

We don't want any driver to use and implement ".get_numa_node()" callback.

Initially, I thought about adding WARN_ON(driver_id != HFI && .get_numa_node)
to the device.c, but decided to stay with comment in ib_verbs.h only.

>
> > + return kzalloc_node(size, gfp, dev->ops.get_numa_node(dev));
> > +
> > + return kzalloc(size, gfp);
> > +}