From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-7.5 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,MAILING_LIST_MULTI,SPF_HELO_NONE, USER_AGENT_SANE_1 autolearn=no autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id F2DC8C433DB for ; Fri, 5 Mar 2021 02:41:41 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id BFFFD64F4C for ; Fri, 5 Mar 2021 02:41:41 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229463AbhCECll (ORCPT ); Thu, 4 Mar 2021 21:41:41 -0500 Received: from mail.kernel.org ([198.145.29.99]:34916 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229436AbhCEClk (ORCPT ); Thu, 4 Mar 2021 21:41:40 -0500 Received: by mail.kernel.org (Postfix) with ESMTPSA id 989E164E60; Fri, 5 Mar 2021 02:41:39 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1614912100; bh=/QEGuxfeeJwVQ4+wJNG01FIJ8rIgGUTLLqLGkiNk8oI=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=oysxvrKXDM+SuUP8U5j5MGhDDXc8I2AXtXURaBzC6rv1F6PAYe6+P2h40Xy0GEZ51 VfcvQW8IV3OuqCyykXR69i4EqInAdtkir8Sz9bk6fv4h9U+PPKi3I30/hrZRzt8e7r yHyUGdSIwnwASjK/6vRws/9lzPTItDirb+bZ4BqcRPH6iTiHBNJYZlJT/Hfh0Q/6FG JJLCf+bPeHWLnbAVQ3MeD9UQvxoq8zSnKWBn2E/LfskASxtdooKPAnGMdCE40MPH4W 37pZBXxSEKqLrwpKk8XNSTEigCbqSkv5EZ9UdbrUY9h6dvt23DrwuzH/GsB28d2bbj NmoYBv3xTBmZg== Date: Fri, 5 Mar 2021 11:41:33 +0900 From: Keith Busch To: Kanchan Joshi Cc: Chaitanya Kulkarni , Kanchan Joshi , "axboe@kernel.dk" , "hch@lst.de" , "io-uring@vger.kernel.org" , "linux-nvme@lists.infradead.org" , "anuj20.g@samsung.com" , "javier.gonz@samsung.com" Subject: Re: [RFC 3/3] nvme: wire up support for async passthrough Message-ID: <20210305024133.GD32558@redsun51.ssa.fujisawa.hgst.com> References: <20210302160734.99610-1-joshi.k@samsung.com> <20210302160734.99610-4-joshi.k@samsung.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.12.1 (2019-06-15) Precedence: bulk List-ID: X-Mailing-List: io-uring@vger.kernel.org On Thu, Mar 04, 2021 at 04:31:11PM +0530, Kanchan Joshi wrote: > On Thu, Mar 4, 2021 at 3:14 AM Chaitanya Kulkarni > wrote: > > > > On 3/2/21 23:22, Kanchan Joshi wrote: > > > + if (!ioucmd) > > > + cptr = &c; > > > + else { > > > + /*for async - allocate cmd dynamically */ > > > + cptr = kmalloc(sizeof(struct nvme_command), GFP_KERNEL); > > > + if (!cptr) > > > + return -ENOMEM; > > > + } > > > + > > > + memset(cptr, 0, sizeof(c)); > > Why not kzalloc and remove memset() ? > > Yes sure. Ideally I want to get rid of the allocation cost. Perhaps > employing kmem_cache/mempool can help. Do you think there is a better > way? I'll need to think on this to consider if the memory cost is worth it (8b to 64b), but you could replace nvme_request's 'struct nvme_command' pointer with the struct itself and not have to allocate anything per IO. An added bonus is that sync and async handling become more the same.