* [PATCH] nvme: adjust multiples of NVME_CTRL_PAGE_SIZE in offset
[not found] <CGME20240523113915epcas5p32626cec7fb138355e74415534a3ece36@epcas5p3.samsung.com>
@ 2024-05-23 11:31 ` Kundan Kumar
2024-05-24 7:40 ` Christoph Hellwig
` (2 more replies)
0 siblings, 3 replies; 4+ messages in thread
From: Kundan Kumar @ 2024-05-23 11:31 UTC (permalink / raw)
To: axboe, hch, kbusch, sagi
Cc: linux-nvme, linux-kernel, joshi.k, anuj20.g, nj.shetty, c.gameti,
gost.dev, Kundan Kumar
bio_vec start offset may be relatively large particularly when large
folio gets added to the bio. A bigger offset will result in avoiding the
single-segment mapping optimization and end up using expensive
mempool_alloc further.
Rather than using absolute value, adjust bv_offset by
NVME_CTRL_PAGE_SIZE while checking if segment can be fitted into one/two
PRP entries.
Suggested-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: Kundan Kumar <kundan.kumar@samsung.com>
---
drivers/nvme/host/pci.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/drivers/nvme/host/pci.c b/drivers/nvme/host/pci.c
index 710043086dff..102a9fb0c65f 100644
--- a/drivers/nvme/host/pci.c
+++ b/drivers/nvme/host/pci.c
@@ -778,7 +778,8 @@ static blk_status_t nvme_map_data(struct nvme_dev *dev, struct request *req,
struct bio_vec bv = req_bvec(req);
if (!is_pci_p2pdma_page(bv.bv_page)) {
- if (bv.bv_offset + bv.bv_len <= NVME_CTRL_PAGE_SIZE * 2)
+ if ((bv.bv_offset & (NVME_CTRL_PAGE_SIZE - 1)) +
+ bv.bv_len <= NVME_CTRL_PAGE_SIZE * 2)
return nvme_setup_prp_simple(dev, req,
&cmnd->rw, &bv);
--
2.25.1
^ permalink raw reply related [flat|nested] 4+ messages in thread
* Re: [PATCH] nvme: adjust multiples of NVME_CTRL_PAGE_SIZE in offset
2024-05-23 11:31 ` [PATCH] nvme: adjust multiples of NVME_CTRL_PAGE_SIZE in offset Kundan Kumar
@ 2024-05-24 7:40 ` Christoph Hellwig
2024-05-24 15:29 ` Sagi Grimberg
2024-05-24 16:01 ` Keith Busch
2 siblings, 0 replies; 4+ messages in thread
From: Christoph Hellwig @ 2024-05-24 7:40 UTC (permalink / raw)
To: Kundan Kumar
Cc: axboe, hch, kbusch, sagi, linux-nvme, linux-kernel, joshi.k,
anuj20.g, nj.shetty, c.gameti, gost.dev
Looks good:
Reviewed-by: Christoph Hellwig <hch@lst.de>
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH] nvme: adjust multiples of NVME_CTRL_PAGE_SIZE in offset
2024-05-23 11:31 ` [PATCH] nvme: adjust multiples of NVME_CTRL_PAGE_SIZE in offset Kundan Kumar
2024-05-24 7:40 ` Christoph Hellwig
@ 2024-05-24 15:29 ` Sagi Grimberg
2024-05-24 16:01 ` Keith Busch
2 siblings, 0 replies; 4+ messages in thread
From: Sagi Grimberg @ 2024-05-24 15:29 UTC (permalink / raw)
To: Kundan Kumar, axboe, hch, kbusch
Cc: linux-nvme, linux-kernel, joshi.k, anuj20.g, nj.shetty, c.gameti,
gost.dev
Reviewed-by: Sagi Grimberg <sagi@grimberg.me>
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH] nvme: adjust multiples of NVME_CTRL_PAGE_SIZE in offset
2024-05-23 11:31 ` [PATCH] nvme: adjust multiples of NVME_CTRL_PAGE_SIZE in offset Kundan Kumar
2024-05-24 7:40 ` Christoph Hellwig
2024-05-24 15:29 ` Sagi Grimberg
@ 2024-05-24 16:01 ` Keith Busch
2 siblings, 0 replies; 4+ messages in thread
From: Keith Busch @ 2024-05-24 16:01 UTC (permalink / raw)
To: Kundan Kumar
Cc: axboe, hch, sagi, linux-nvme, linux-kernel, joshi.k, anuj20.g,
nj.shetty, c.gameti, gost.dev
On Thu, May 23, 2024 at 05:01:49PM +0530, Kundan Kumar wrote:
> bio_vec start offset may be relatively large particularly when large
> folio gets added to the bio. A bigger offset will result in avoiding the
> single-segment mapping optimization and end up using expensive
> mempool_alloc further.
>
> Rather than using absolute value, adjust bv_offset by
> NVME_CTRL_PAGE_SIZE while checking if segment can be fitted into one/two
> PRP entries.
Thanks, applied to nvme-6.10.
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2024-05-24 16:01 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
[not found] <CGME20240523113915epcas5p32626cec7fb138355e74415534a3ece36@epcas5p3.samsung.com>
2024-05-23 11:31 ` [PATCH] nvme: adjust multiples of NVME_CTRL_PAGE_SIZE in offset Kundan Kumar
2024-05-24 7:40 ` Christoph Hellwig
2024-05-24 15:29 ` Sagi Grimberg
2024-05-24 16:01 ` Keith Busch
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox