From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from verein.lst.de (verein.lst.de [213.95.11.211]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id E4E6C269AFB; Wed, 23 Apr 2025 09:05:59 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=213.95.11.211 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1745399161; cv=none; b=dHhAZ4T/pkrlxHz+IyIzp5SZFoab4/NKu3YzgyX7xQWb8uYQu5NSdlwxPVW7+OyD9LQpf/NjHzxVxZSelV4WPHEXI9qBJ8CbcPNLnnSV7o1HuYoIa3CvXpQYiIp0d6QuOhyvho/W35598RorK30aS8H1gV/GVFWprKnlhbpKQqQ= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1745399161; c=relaxed/simple; bh=yZ14u45nosFnORYpl+CjzdK4IPUWLeh5MUca7Ao0xuw=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=toAk8Qwy0Yc8J2hdl2I0X9vZWSXI+892xu3PsxCJxjvuerbc0zMfHKCmDp6ju0mBzjZGy5u3tkFrgfG555Xp/GDV8Cy+gaVneYMltWejNtonnhd9hcVUCsb98RF+2hGDnL3p+t7x01yQhDb4za332cJ7UD1b1CtCpxm2o52GyBQ= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=lst.de; spf=pass smtp.mailfrom=lst.de; arc=none smtp.client-ip=213.95.11.211 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=lst.de Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=lst.de 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> Precedence: bulk X-Mailing-List: linux-doc@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: 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) 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.