[PATCH v2 2/3] nvme-pci: limit queue count to housekeeping CPUs

Daniel Wagner posted 3 patches 1 year, 5 months ago
[PATCH v2 2/3] nvme-pci: limit queue count to housekeeping CPUs
Posted by Daniel Wagner 1 year, 5 months ago
When isolcpus is used, the nvme-pci driver should only allocated queues
for the housekeeping CPUs. Use the blk_mq_num_possible_queues helper
which returns the correct number of queues for all configurations.

Signed-off-by: Daniel Wagner <dwagner@suse.de>
---
 drivers/nvme/host/pci.c | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/drivers/nvme/host/pci.c b/drivers/nvme/host/pci.c
index 102a9fb0c65f..193144e6d59b 100644
--- a/drivers/nvme/host/pci.c
+++ b/drivers/nvme/host/pci.c
@@ -81,7 +81,7 @@ static int io_queue_count_set(const char *val, const struct kernel_param *kp)
 	int ret;
 
 	ret = kstrtouint(val, 10, &n);
-	if (ret != 0 || n > num_possible_cpus())
+	if (ret != 0 || n > blk_mq_num_possible_queues())
 		return -EINVAL;
 	return param_set_uint(val, kp);
 }
@@ -2263,7 +2263,8 @@ static unsigned int nvme_max_io_queues(struct nvme_dev *dev)
 	 */
 	if (dev->ctrl.quirks & NVME_QUIRK_SHARED_TAGS)
 		return 1;
-	return num_possible_cpus() + dev->nr_write_queues + dev->nr_poll_queues;
+	return blk_mq_num_possible_queues() + dev->nr_write_queues +
+		dev->nr_poll_queues;
 }
 
 static int nvme_setup_io_queues(struct nvme_dev *dev)

-- 
2.45.2
Re: [PATCH v2 2/3] nvme-pci: limit queue count to housekeeping CPUs
Posted by Sagi Grimberg 1 year, 5 months ago
Reviewed-by: Sagi Grimberg <sagi@grimberg.me>
Re: [PATCH v2 2/3] nvme-pci: limit queue count to housekeeping CPUs
Posted by Hannes Reinecke 1 year, 5 months ago
On 6/27/24 16:10, Daniel Wagner wrote:
> When isolcpus is used, the nvme-pci driver should only allocated queues
> for the housekeeping CPUs. Use the blk_mq_num_possible_queues helper
> which returns the correct number of queues for all configurations.
> 
> Signed-off-by: Daniel Wagner <dwagner@suse.de>
> ---
>   drivers/nvme/host/pci.c | 5 +++--
>   1 file changed, 3 insertions(+), 2 deletions(-)
> 
Reviewed-by: Hannes Reinecke <hare@suse.de>

Cheers,

Hannes
-- 
Dr. Hannes Reinecke                  Kernel Storage Architect
hare@suse.de                                +49 911 74053 688
SUSE Software Solutions GmbH, Frankenstr. 146, 90461 Nürnberg
HRB 36809 (AG Nürnberg), GF: I. Totev, A. McDonald, W. Knoblich

Re: [PATCH v2 2/3] nvme-pci: limit queue count to housekeeping CPUs
Posted by Christoph Hellwig 1 year, 5 months ago
Looks good:

Reviewed-by: Christoph Hellwig <hch@lst.de>