From: ming.lei@redhat.com (Ming Lei)
Subject: [PATCH] nvme-pci: fix single segment optimization
Date: Sat, 18 May 2019 06:50:35 +0800 [thread overview]
Message-ID: <20190517225035.25008-1-ming.lei@redhat.com> (raw)
Commit dff824b2aadb ("nvme-pci: optimize mapping of small single segment
requests") supposes that single request request only includes single
bvec.
However, this assumption is wrong, since the single segment may cross
multiple bios, then there may be multiple bvecs involved in the segment.
Fixes this issue by checking if it is single bio request, if yes, the
request includes only one bvec, given we don't merge bvecs to one
segment if they belong to same bio.
Cc: Sagi Grimberg <sagi at grimberg.me>
Fixes: dff824b2aadb ("nvme-pci: optimize mapping of small single segment requests")
Signed-off-by: Ming Lei <ming.lei at redhat.com>
---
Hi Christoph,
This patch is candidate on your patch of 'block: don't decrement
nr_phys_segments for physically contigous segments', and I suggest to
take this one because this patch is simpler, and more suitable to serve
as v5.2 fix.
And your patchset can aim at 5.3 as cleanup after careful
test/evaluation on performance effect.
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 2a8708c9ac18..6a38a760a295 100644
--- a/drivers/nvme/host/pci.c
+++ b/drivers/nvme/host/pci.c
@@ -824,7 +824,8 @@ static blk_status_t nvme_map_data(struct nvme_dev *dev, struct request *req,
blk_status_t ret = BLK_STS_RESOURCE;
int nr_mapped;
- if (blk_rq_nr_phys_segments(req) == 1) {
+ /* Avoid the optimization if the single segment crosses two bios */
+ if (blk_rq_nr_phys_segments(req) == 1 && req->bio == req->biotail) {
struct bio_vec bv = req_bvec(req);
if (!is_pci_p2pdma_page(bv.bv_page)) {
--
2.20.1
next reply other threads:[~2019-05-17 22:50 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-05-17 22:50 Ming Lei [this message]
2019-05-20 11:16 ` [PATCH] nvme-pci: fix single segment optimization Christoph Hellwig
2019-05-21 1:08 ` Ming Lei
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20190517225035.25008-1-ming.lei@redhat.com \
--to=ming.lei@redhat.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox