[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID:
<PAXPR83MB05572E3DDF6D2AEC970A2CBAB4102@PAXPR83MB0557.EURPRD83.prod.outlook.com>
Date: Wed, 24 Apr 2024 08:50:18 +0000
From: Konstantin Taranov <kotaranov@...rosoft.com>
To: Long Li <longli@...rosoft.com>, Konstantin Taranov
<kotaranov@...ux.microsoft.com>, "sharmaajay@...rosoft.com"
<sharmaajay@...rosoft.com>, "jgg@...pe.ca" <jgg@...pe.ca>, "leon@...nel.org"
<leon@...nel.org>
CC: "linux-rdma@...r.kernel.org" <linux-rdma@...r.kernel.org>,
"linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>
Subject: RE: [PATCH rdma-next 4/6] RDMA/mana_ib: introduce a helper to remove
cq callbacks
> > +void mana_ib_remove_cq_cb(struct mana_ib_dev *mdev, struct
> > mana_ib_cq
> > +*cq) {
> > + struct gdma_context *gc = mdev_to_gc(mdev);
> > +
> > + if (cq->queue.id >= gc->max_num_cqs)
> > + return;
> > +
> > + kfree(gc->cq_table[cq->queue.id]);
> > + gc->cq_table[cq->queue.id] = NULL;
>
> Why the check for (cq->queue.id != INVALID_QUEUE_ID) is removed?
As max_num_cqs is always less than INVALID_QUEUE_ID, it is included in the "if".
I can add " || cq->queue.id == INVALID_QUEUE_ID " to the condition if you want.
> > @@ -173,13 +171,6 @@ static int mana_ib_create_qp_rss(struct ib_qp
> > *ibqp, struct ib_pd *pd,
> > goto fail;
> > }
> >
> > - gdma_cq_allocated = kcalloc(ind_tbl_size,
> > sizeof(*gdma_cq_allocated),
> > - GFP_KERNEL);
> > - if (!gdma_cq_allocated) {
> > - ret = -ENOMEM;
> > - goto fail;
> > - }
> > -
>
> Why the allocation for CQs is removed? This is not related to this patch.
It becomes the dead code if I add the helper. You allocated gdma_cq_allocated to
temporary store gdma_queue to be able to deallocate them. The introduced helper
frees pointers to gdma_queue from kfree(gc->cq_table[cq->queue.id]), making
gdma_cq_allocated unused.
Powered by blists - more mailing lists