nvme: adjust multiples of NVME_CTRL_PAGE_SIZE in offset
A message that is not in the archive (sent off-list or not yet received): CGME20240523113915epcas5p32626cec7fb138355e74415534a3ece36@epcas5p3.samsung.com
PATCH 1/1 nvme: adjust multiples of NVME_CTRL_PAGE_SIZE in offset
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.
--- drivers/nvme/host/pci.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
drivers/nvme/host/pci.c +2 -1
@@ -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);
Signature · 1 line
2.25.1
Looks good:
Quoted 8 lines · Kundan Kumar
bio_vecstart 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 expensivemempool_allocfurther.Rather than using absolute value, adjust
bv_offsetbyNVME_CTRL_PAGE_SIZEwhile checking if segment can be fitted into one/two PRP entries.
Thanks, applied to nvme-6.10.