[PATCH] nvme-pci: introduce parameter to clamp io queues
Keith Busch
kbusch at meta.com
Thu Jul 30 09:20:55 PDT 2026
From: Keith Busch <kbusch at 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 at gmail.com>
Signed-off-by: Keith Busch <kbusch at 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
More information about the Linux-nvme
mailing list