Skip to content

Commit 4082c98

Browse files
igawaxboe
authored andcommitted
nvme-pci: use block layer helpers to calculate num of queues
The calculation of the upper limit for queues does not depend solely on the number of possible CPUs; for example, the isolcpus kernel command-line option must also be considered. To account for this, the block layer provides a helper function to retrieve the maximum number of queues. Use it to set an appropriate upper queue number limit. Reviewed-by: Christoph Hellwig <[email protected]> Reviewed-by: Hannes Reinecke <[email protected]> Signed-off-by: Daniel Wagner <[email protected]> Reviewed-by: Chaitanya Kulkarni <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Jens Axboe <[email protected]>
1 parent 3f27c1d commit 4082c98

1 file changed

Lines changed: 3 additions & 2 deletions

File tree

drivers/nvme/host/pci.c

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -108,7 +108,7 @@ static int io_queue_count_set(const char *val, const struct kernel_param *kp)
108108
int ret;
109109

110110
ret = kstrtouint(val, 10, &n);
111-
if (ret != 0 || n > num_possible_cpus())
111+
if (ret != 0 || n > blk_mq_num_possible_queues(0))
112112
return -EINVAL;
113113
return param_set_uint(val, kp);
114114
}
@@ -2629,7 +2629,8 @@ static unsigned int nvme_max_io_queues(struct nvme_dev *dev)
26292629
*/
26302630
if (dev->ctrl.quirks & NVME_QUIRK_SHARED_TAGS)
26312631
return 1;
2632-
return num_possible_cpus() + dev->nr_write_queues + dev->nr_poll_queues;
2632+
return blk_mq_num_possible_queues(0) + dev->nr_write_queues +
2633+
dev->nr_poll_queues;
26332634
}
26342635

26352636
static int nvme_setup_io_queues(struct nvme_dev *dev)

0 commit comments

Comments
 (0)