From: shan.hai@oracle.com (Shan Hai)
Subject: [PATCH 2/2] nvme-pci: take the io_queue_number into account when setting number of io queues
Date: Fri, 21 Dec 2018 14:04:13 +0800 [thread overview]
Message-ID: <1545372253-28025-2-git-send-email-shan.hai@oracle.com> (raw)
In-Reply-To: <1545372253-28025-1-git-send-email-shan.hai@oracle.com>
Add a wrapper around num_possible_cpus() to take the new added module
parameter account when setting number of io queues.
Signed-off-by: Shan Hai <shan.hai at oracle.com>
---
drivers/nvme/host/pci.c | 11 ++++++++---
1 file changed, 8 insertions(+), 3 deletions(-)
diff --git a/drivers/nvme/host/pci.c b/drivers/nvme/host/pci.c
index 0d60451..e359e90 100644
--- a/drivers/nvme/host/pci.c
+++ b/drivers/nvme/host/pci.c
@@ -219,6 +219,11 @@ struct nvme_iod {
struct scatterlist inline_sg[0];
};
+static inline unsigned int nvme_io_queue_number(void)
+{
+ return min_t(unsigned int, io_queue_number, num_possible_cpus());
+}
+
/*
* Check we didin't inadvertently grow the command struct
*/
@@ -241,7 +246,7 @@ static inline void _nvme_check_size(void)
static inline unsigned int nvme_dbbuf_size(u32 stride)
{
- return ((num_possible_cpus() + 1) * 8 * stride);
+ return ((nvme_io_queue_number() + 1) * 8 * stride);
}
static int nvme_dbbuf_dma_alloc(struct nvme_dev *dev)
@@ -1923,7 +1928,7 @@ static int nvme_setup_io_queues(struct nvme_dev *dev)
.pre_vectors = 1
};
- nr_io_queues = num_possible_cpus();
+ nr_io_queues = nvme_io_queue_number();
result = nvme_set_queue_count(&dev->ctrl, &nr_io_queues);
if (result < 0)
return result;
@@ -2512,7 +2517,7 @@ static int nvme_probe(struct pci_dev *pdev, const struct pci_device_id *id)
if (!dev)
return -ENOMEM;
- dev->queues = kcalloc_node(num_possible_cpus() + 1,
+ dev->queues = kcalloc_node(nvme_io_queue_number() + 1,
sizeof(struct nvme_queue), GFP_KERNEL, node);
if (!dev->queues)
goto free;
--
2.7.4
next prev parent reply other threads:[~2018-12-21 6:04 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-12-21 6:04 [PATCH 1/2] nvme-pci: add module param for io queue number Shan Hai
2018-12-21 6:04 ` Shan Hai [this message]
2018-12-21 15:02 ` Bart Van Assche
2018-12-24 1:10 ` Shan Hai
2019-01-04 18:09 ` Christoph Hellwig
2019-01-05 0:18 ` Shan Hai
2018-12-23 0:38 ` Ming Lei
2018-12-24 1:02 ` Shan Hai
2018-12-24 1:47 ` Ming Lei
2018-12-24 2:12 ` Shan Hai
2018-12-24 2:46 ` Ming Lei
2018-12-24 3:05 ` Shan Hai
2018-12-26 10:23 ` 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=1545372253-28025-2-git-send-email-shan.hai@oracle.com \
--to=shan.hai@oracle.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