From: willy@linux.intel.com (Matthew Wilcox)
Subject: [PATCH] Call nvme_process_cq from submit path
Date: Fri, 17 May 2013 08:57:00 -0400 [thread overview]
Message-ID: <20130517125700.GN6057@linux.intel.com> (raw)
There are a couple of good reasons to process the CQ from the submit path.
One is that if the SQ is full, processing the CQ may free up some slots
in the SQ.
Another is that, if the interrupt mitigation is configured correctly, we
may be able to avoid receiving an interrupt if we process the completion
before the timer fires.
Processing an empty CQ should be cheap; it's two loads from the nvmeq
data structure, a 64-bit load from the CQ and three compares. I'd be
intrigued to see if anyone can measure a performance decrease from doing
this with any workload.
NB: this isn't the patch I'd be committing; I'll move nvme_process_cq
above nvme_make_request, but that move makes this look like a Big Deal
when at its heart, it's a one-line patch.
diff --git a/drivers/block/nvme-core.c b/drivers/block/nvme-core.c
index 8efdfaa..f55d666 100644
--- a/drivers/block/nvme-core.c
+++ b/drivers/block/nvme-core.c
@@ -708,6 +708,8 @@ static int nvme_submit_bio_queue(struct nvme_queue *nvmeq, struct nvme_ns *ns,
return result;
}
+static irqreturn_t nvme_process_cq(struct nvme_queue *nvmeq);
+
static void nvme_make_request(struct request_queue *q, struct bio *bio)
{
struct nvme_ns *ns = q->queuedata;
@@ -722,7 +724,7 @@ static void nvme_make_request(struct request_queue *q, struct bio *bio)
add_wait_queue(&nvmeq->sq_full, &nvmeq->sq_cong_wait);
bio_list_add(&nvmeq->sq_cong, bio);
}
-
+ nvme_process_cq(nvmeq);
spin_unlock_irq(&nvmeq->q_lock);
put_nvmeq(nvmeq);
}
reply other threads:[~2013-05-17 12:57 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
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=20130517125700.GN6057@linux.intel.com \
--to=willy@linux.intel.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;
as well as URLs for NNTP newsgroup(s).