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 Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by smtp.lore.kernel.org (Postfix) with ESMTP id AA696C369CB for ; Wed, 23 Apr 2025 09:06:02 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 6DC7E6B00A5; Wed, 23 Apr 2025 05:06:01 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 663536B00A6; Wed, 23 Apr 2025 05:06:01 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 52B236B00A7; Wed, 23 Apr 2025 05:06:01 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0016.hostedemail.com [216.40.44.16]) by kanga.kvack.org (Postfix) with ESMTP id 338116B00A5 for ; Wed, 23 Apr 2025 05:06:01 -0400 (EDT) Received: from smtpin10.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay07.hostedemail.com (Postfix) with ESMTP id 94441161BD9 for ; Wed, 23 Apr 2025 09:06:01 +0000 (UTC) X-FDA: 83364726522.10.CE7EB61 Received: from verein.lst.de (verein.lst.de [213.95.11.211]) by imf19.hostedemail.com (Postfix) with ESMTP id A5CAB1A000C for ; Wed, 23 Apr 2025 09:05:59 +0000 (UTC) Authentication-Results: imf19.hostedemail.com; dkim=none; dmarc=pass (policy=none) header.from=lst.de; spf=pass (imf19.hostedemail.com: domain of hch@lst.de designates 213.95.11.211 as permitted sender) smtp.mailfrom=hch@lst.de ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1745399160; a=rsa-sha256; cv=none; b=NJ8PbBf+0izzrt6sfSbaWRNNgWb2g2Js9KZPr+n4zGEOpV3v/+0TR2u7Z8csk5A2wSBQ4d fbheVIfZ2yZDHLF2GlNdXR9vLuHgAmu/6jaL5iVVYuLW+wi4CUHTAdMJa518i+f6gsIrE3 6vETsffGhahe20Yc519dEx5UHy7aAjc= ARC-Authentication-Results: i=1; imf19.hostedemail.com; dkim=none; dmarc=pass (policy=none) header.from=lst.de; spf=pass (imf19.hostedemail.com: domain of hch@lst.de designates 213.95.11.211 as permitted sender) smtp.mailfrom=hch@lst.de ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1745399160; h=from:from:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=KbJH1/26bYB/KlsspbBy4LaUp8pdxEEHrYugsxNpsxY=; b=USEmh4doKlvtwlXa00gaB99ioUFZPSeZaH8ZsZxJTEgKT2kuyCWqmjcObMBjd7ckOsJ0+G edA+jbHasJjoz3fV3CqDcbvlM83/+O24mGZDHRmTmLRldwvBphBrpwymZQYnBTEyLl8ZAm Xxtzza7IhWIst+O6aSd2R0nCDQPaUR8= Received: by verein.lst.de (Postfix, from userid 2407) id E400768AFE; Wed, 23 Apr 2025 11:05:52 +0200 (CEST) Date: Wed, 23 Apr 2025 11:05:52 +0200 From: Christoph Hellwig To: Leon Romanovsky Cc: Marek Szyprowski , Jens Axboe , Christoph Hellwig , Keith Busch , Jake Edge , Jonathan Corbet , Jason Gunthorpe , Zhu Yanjun , Robin Murphy , Joerg Roedel , Will Deacon , Sagi Grimberg , Bjorn Helgaas , Logan Gunthorpe , Yishai Hadas , Shameer Kolothum , Kevin Tian , Alex Williamson , =?iso-8859-1?B?Suly9G1l?= Glisse , Andrew Morton , linux-doc@vger.kernel.org, linux-kernel@vger.kernel.org, linux-block@vger.kernel.org, linux-rdma@vger.kernel.org, iommu@lists.linux.dev, linux-nvme@lists.infradead.org, linux-pci@vger.kernel.org, kvm@vger.kernel.org, linux-mm@kvack.org, Niklas Schnelle , Chuck Lever , Luis Chamberlain , Matthew Wilcox , Dan Williams , Kanchan Joshi , Chaitanya Kulkarni , Leon Romanovsky Subject: Re: [PATCH v9 22/24] nvme-pci: use a better encoding for small prp pool allocations Message-ID: <20250423090552.GA381@lst.de> References: <973ed41249e12766383b3cedac799692f9bda3b8.1745394536.git.leon@kernel.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <973ed41249e12766383b3cedac799692f9bda3b8.1745394536.git.leon@kernel.org> User-Agent: Mutt/1.5.17 (2007-11-01) X-Rspamd-Server: rspam10 X-Rspamd-Queue-Id: A5CAB1A000C X-Stat-Signature: j75jbr8eeiugssj9o37o8jjojpjf613o X-Rspam-User: X-HE-Tag: 1745399159-477341 X-HE-Meta: U2FsdGVkX18UxibTi3idPfehQr6H2MGHC8mKrZCZ7ZfvIO38lpi3RcrkQ0qumwbvhNFMeg+H/bFsV0AOBMQo7s2Y5z9V5WKYG/dIJnzFDJhkwJzNLEDAEM7fNC8eKLFY0BMiHCe/I4e00yQuptpCYpyf/RyYnGAca/v6TaRjqIHD4qzRi6ujubTVvnUGEhSvCyskwubPcL3CxcpCnVvUT3Q0tFhXXEnzmSSAl3Fq9h87PX2Q5M9Nuh7p65WpdnCcNrVSbsdLGA6iOi4T9v0a+fHyVwYvmFJJjXW9FgZ+cl0M01XWupiEXOnwvl4Op7HU+bCnlAPuGmF5z3vvVRH8mXz/2ZeNVI0nOeFYez+GXcyk4cytd4SgMpU99Np2GbQiI4AY23oc1eB4U/1ULAYz839itOFkkwdhSEZP+RpiH4zyyQ1r/tRNCmLLkS/gx0AvigN3zWxIs9ioiZJ1sZTQX8XBPFkSpuIs6c7MlmRWk2u9PHCw98pnCZQQfD+dAZer6TFwq5+8TPOp27q6GP3JWqHyRSdRSW8pyc2KWdL6FnFkrjI63LX2rbLMAc1rrbtTDcuRsDsfx17en4t/LplVbQXsmbBcwUY+9EOsW2CD90vMyiCqfm1hrhP/1JgVt1PoYb4JblSapYshEyTJFjXxH4/g6nnBK16YiX95QNJlddgi2QQeT5PJp8R+0YxnfhiKGODqm8uxqKCDjgU+gG5xCNL0QH7Ry8MRvUGeEIU1/pFSWtupkH5v58VE1NZoDK5kqavh53DTo2NXTbnaXNKovOiHt41alWNZreoZj3fgwgXZoG8fAAYIXINXNdgJTRFWfckyq9fh1V/k+bNb8MdEuB7I9nhu+wUK7mX9w274Wg0Nnr39xAH5RoqL/5tsJ4H3bXWtHz0k3vK7Cdk4sxQZ8v0OCt7rTM73gQ7wvD9PUOZ2OKde4YCwpnQH4wU5Wfo43HlbdECWNV0M/e04hcp eogflNxW MximUQjlWcGDerK0yzignQlR422hVP16wrwSH2EZ9ETHeKvhTb0Q0qOpflYr3mfB9bBibKJO8T5o2uzzWD74o6b3LmacgX3UJZJFtNgNxZCJweXnHxi9YKQdgTuXC3wOS3x76n7WbbWoMGtE= X-Bogosity: Ham, tests=bogofilter, spamicity=0.000000, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: List-Subscribe: List-Unsubscribe: On Wed, Apr 23, 2025 at 11:13:13AM +0300, Leon Romanovsky wrote: > From: Christoph Hellwig > > There is plenty of unused space in the iod next to nr_descriptors. > Add a separate flag to encode that the transfer is using the full > page sized pool, and use a normal 0..n count for the number of > descriptors. > > Signed-off-by: Christoph Hellwig > Tested-by: Jens Axboe > [ Leon: changed original bool variable to be flag as was proposed by Kanchan ] > Signed-off-by: Kanchan Joshi > Signed-off-by: Leon Romanovsky > --- > drivers/nvme/host/pci.c | 93 ++++++++++++++++++++--------------------- > 1 file changed, 46 insertions(+), 47 deletions(-) > > diff --git a/drivers/nvme/host/pci.c b/drivers/nvme/host/pci.c > index 638e759b29ad..7e93536d01cb 100644 > --- a/drivers/nvme/host/pci.c > +++ b/drivers/nvme/host/pci.c > @@ -44,6 +44,7 @@ > #define NVME_MAX_SEGS 128 > #define NVME_MAX_META_SEGS 15 > #define NVME_MAX_NR_DESCRIPTORS 5 > +#define NVME_SMALL_DESCRIPTOR_SIZE 256 > > static int use_threaded_interrupts; > module_param(use_threaded_interrupts, int, 0444); > @@ -219,6 +220,10 @@ struct nvme_queue { > struct completion delete_done; > }; > > +enum { > + IOD_LARGE_DESCRIPTORS = 1, /* uses the full page sized descriptor pool */ This is used as a ORable flag, I'd make that explicit: /* uses the full page sized descriptor pool */ IOD_LARGE_DESCRIPTORS = 1U << 0, and similar for the next flag added in the next patch. > struct nvme_request req; > struct nvme_command cmd; > bool aborted; > - /* # of PRP/SGL descriptors: (0 for small pool) */ > - s8 nr_descriptors; > + u8 nr_descriptors; /* # of PRP/SGL descriptors */ > + unsigned int flags; And this should be limited to a u16 to not bloat the structure.