Thread (44 messages) 44 messages, 7 authors, 2016-01-20

Re: [PATCH 07/13] IB: add a proper completion queue abstraction

From: Christoph Hellwig <hch@lst.de>
Date: 2015-12-11 14:17:58
Also in: linux-scsi, lkml

On Thu, Dec 10, 2015 at 10:42:22AM -0800, Bart Van Assche wrote:
quoted
+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.
quoted
--- 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.
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help