From: Keith Busch <kbusch@meta.com>
To: <linux-nvme@lists.infradead.org>
Cc: <hch@lst.de>, <tglx@linutronix.de>,
Keith Busch <kbusch@kernel.org>,
santhosh kumar <santhu.linux@gmail.com>
Subject: [PATCH] nvme-pci: introduce parameter to clamp io queues
Date: Thu, 30 Jul 2026 09:20:55 -0700 [thread overview]
Message-ID: <20260730162056.1421564-1-kbusch@meta.com> (raw)
From: Keith Busch <kbusch@kernel.org>
Large deployments can have the nvme driver's resource requests easily
exceed the platform's interrupt capabilities leading to an unbalanced
allocation. The driver doesn't know what devices it may see, so it can
not determine reasonable limits for itself. Provide a user settable
module parameter to limit the number of IO queues the driver may
request.
Link: https://lore.kernel.org/lkml/CAKudn=rGv-xwAwTis8wpg31mxekyE4YH-E8CQoDTYovsPrENnQ@mail.gmail.com/
Reported-by: santhosh kumar <santhu.linux@gmail.com>
Signed-off-by: Keith Busch <kbusch@kernel.org>
---
drivers/nvme/host/pci.c | 9 +++++++--
1 file changed, 7 insertions(+), 2 deletions(-)
diff --git a/drivers/nvme/host/pci.c b/drivers/nvme/host/pci.c
index 375e7a1fc91dc..cb80f0c73562f 100644
--- a/drivers/nvme/host/pci.c
+++ b/drivers/nvme/host/pci.c
@@ -109,6 +109,11 @@ static unsigned int io_queue_depth = 1024;
module_param_cb(io_queue_depth, &io_queue_depth_ops, &io_queue_depth, 0644);
MODULE_PARM_DESC(io_queue_depth, "set io queue depth, should >= 2 and < 4096");
+static unsigned short max_io_queues;
+module_param(max_io_queues, ushort, 0644);
+MODULE_PARM_DESC(max_io_queues,
+ "max io queues to ask for (default 0 means no limit)");
+
static struct quirk_entry *nvme_pci_quirk_list;
static unsigned int nvme_pci_quirk_count;
@@ -2953,8 +2958,8 @@ static unsigned int nvme_max_io_queues(struct nvme_dev *dev)
*/
if (dev->ctrl.quirks & NVME_QUIRK_SHARED_TAGS)
return 1;
- return blk_mq_num_possible_queues(0) + dev->nr_write_queues +
- dev->nr_poll_queues;
+ return min_not_zero(max_io_queues, blk_mq_num_possible_queues(0) +
+ dev->nr_write_queues + dev->nr_poll_queues);
}
static int nvme_setup_io_queues(struct nvme_dev *dev)
--
2.53.0-Meta
reply other threads:[~2026-07-30 16:22 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=20260730162056.1421564-1-kbusch@meta.com \
--to=kbusch@meta.com \
--cc=hch@lst.de \
--cc=kbusch@kernel.org \
--cc=linux-nvme@lists.infradead.org \
--cc=santhu.linux@gmail.com \
--cc=tglx@linutronix.de \
/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