On Thu, Dec 10, 2015 at 10:42:22AM -0800, Bart Van Assche wrote: >> +struct ib_cq *ib_alloc_cq(struct ib_device *dev, void *private, >> + int nr_cqe, int comp_vector, enum ib_poll_context poll_ctx) >> +{ > > [ ... ] >> + cq->wc = kmalloc_array(IB_POLL_BATCH, sizeof(*cq->wc), GFP_KERNEL); > > Why is the wc array allocated separately instead of being embedded in > struct ib_cq ? I think the faster completion queues can be created the > better so if it is possible to eliminate the above kmalloc() call I would > prefer that.
I originally allocated an embedded aray, but Sagi pointed out that we'd waste memory for CQs not using the new API, so I changed it. The embedded one would be quite a bit simpler indeed. >> --- a/drivers/infiniband/ulp/srp/ib_srp.c >> +++ b/drivers/infiniband/ulp/srp/ib_srp.c >> @@ -457,10 +457,11 @@ static struct srp_fr_pool *srp_alloc_fr_pool(struct >> srp_target_port *target) >> static void srp_destroy_qp(struct srp_rdma_ch *ch) >> { >> static struct ib_qp_attr attr = { .qp_state = IB_QPS_ERR }; >> - static struct ib_recv_wr wr = { .wr_id = SRP_LAST_WR_ID }; >> + static struct ib_recv_wr wr = { 0 }; >> struct ib_recv_wr *bad_wr; >> int ret; > > Is explicit initialization to "{ 0 }" really needed for static structures ? It shouldn't be needed, but I can't see how it harms either. -- To unsubscribe from this list: send the line "unsubscribe linux-rdma" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html