Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753752AbbLKOR6 (ORCPT ); Fri, 11 Dec 2015 09:17:58 -0500 Received: from verein.lst.de ([213.95.11.211]:39405 "EHLO newverein.lst.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752544AbbLKORw (ORCPT ); Fri, 11 Dec 2015 09:17:52 -0500 Date: Fri, 11 Dec 2015 15:17:49 +0100 From: Christoph Hellwig To: Bart Van Assche Cc: linux-rdma@vger.kernel.org, sagig@dev.mellanox.co.il, axboe@fb.com, linux-scsi@vger.kernel.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH 07/13] IB: add a proper completion queue abstraction Message-ID: <20151211141749.GA20201@lst.de> References: <1449521512-22921-1-git-send-email-hch@lst.de> <1449521512-22921-8-git-send-email-hch@lst.de> <5669C78E.6070302@sandisk.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <5669C78E.6070302@sandisk.com> User-Agent: Mutt/1.5.17 (2007-11-01) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1582 Lines: 35 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-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/