Message ID | 20240507144509.37477-2-kundan.kumar@samsung.com (mailing list archive) |
---|---|
State | New, archived |
Headers | show |
Series | block: add larger order folio instead of pages | expand |
This needs to go to the nvme list and all nvme maintainers. Please
just resend it standalone while you're at it, as it's a small and
very usful improvement on it's own:
Reviewed-by: Christoph Hellwig <hch@lst.de>
On Thu, May 23, 2024 at 2:21 PM Christoph Hellwig <hch@lst.de> wrote: > > This needs to go to the nvme list and all nvme maintainers. Please > just resend it standalone while you're at it, as it's a small and > very usful improvement on it's own: Sure Christoph, I will send a standalone patch for this to nvme list. > > Reviewed-by: Christoph Hellwig <hch@lst.de> >
diff --git a/drivers/nvme/host/pci.c b/drivers/nvme/host/pci.c index 8e0bb9692685..c6408871466f 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);
bio_vec start offset may be relatively large particularly when large folio was 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(-)