From: Daniel Wagner <wagi@kernel.org>
To: Jens Axboe <axboe@kernel.dk>, Christoph Hellwig <hch@lst.de>
Cc: Keith Busch <kbusch@kernel.org>, Sagi Grimberg <sagi@grimberg.me>,
"Michael S. Tsirkin" <mst@redhat.com>,
"Martin K. Petersen" <martin.petersen@oracle.com>,
Thomas Gleixner <tglx@linutronix.de>,
Costa Shulyupin <costa.shul@redhat.com>,
Juri Lelli <juri.lelli@redhat.com>,
Valentin Schneider <vschneid@redhat.com>,
Waiman Long <llong@redhat.com>, Ming Lei <ming.lei@redhat.com>,
Frederic Weisbecker <frederic@kernel.org>,
Hannes Reinecke <hare@suse.de>,
linux-kernel@vger.kernel.org, linux-block@vger.kernel.org,
linux-nvme@lists.infradead.org, megaraidlinux.pdl@broadcom.com,
linux-scsi@vger.kernel.org, storagedev@microchip.com,
virtualization@lists.linux.dev,
GR-QLogic-Storage-Upstream@marvell.com,
Daniel Wagner <wagi@kernel.org>
Subject: [PATCH 3/5] nvme-pci: use block layer helpers to calculate num of queues
Date: Tue, 17 Jun 2025 15:43:25 +0200 [thread overview]
Message-ID: <20250617-isolcpus-queue-counters-v1-3-13923686b54b@kernel.org> (raw)
In-Reply-To: <20250617-isolcpus-queue-counters-v1-0-13923686b54b@kernel.org>
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 <hch@lst.de>
Reviewed-by: Hannes Reinecke <hare@suse.de>
Signed-off-by: Daniel Wagner <wagi@kernel.org>
---
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 8ff12e415cb5d1529d760b33f3e0cf3b8d1555f1..f134bf4f41b2581e4809e618250de7985b5c9701 100644
--- a/drivers/nvme/host/pci.c
+++ b/drivers/nvme/host/pci.c
@@ -97,7 +97,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(0))
return -EINVAL;
return param_set_uint(val, kp);
}
@@ -2520,7 +2520,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(0) + dev->nr_write_queues +
+ dev->nr_poll_queues;
}
static int nvme_setup_io_queues(struct nvme_dev *dev)
--
2.49.0
next prev parent reply other threads:[~2025-06-17 13:43 UTC|newest]
Thread overview: 14+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-06-17 13:43 [PATCH 0/5] blk: introduce block layer helpers to calculate num of queues Daniel Wagner
2025-06-17 13:43 ` [PATCH 1/5] lib/group_cpus: Let group_cpu_evenly() return the number of initialized masks Daniel Wagner
2025-06-23 5:19 ` Christoph Hellwig
2025-06-25 4:34 ` Chaitanya Kulkarni
2025-06-17 13:43 ` [PATCH 2/5] blk-mq: add number of queue calc helper Daniel Wagner
2025-06-25 4:35 ` Chaitanya Kulkarni
2025-06-17 13:43 ` Daniel Wagner [this message]
2025-06-25 4:37 ` [PATCH 3/5] nvme-pci: use block layer helpers to calculate num of queues Chaitanya Kulkarni
2025-06-17 13:43 ` [PATCH 4/5] scsi: " Daniel Wagner
2025-06-25 4:37 ` Chaitanya Kulkarni
2025-06-17 13:43 ` [PATCH 5/5] virtio: blk/scsi: " Daniel Wagner
2025-06-25 4:38 ` Chaitanya Kulkarni
2025-06-30 6:29 ` [PATCH 0/5] blk: introduce " Daniel Wagner
2025-07-01 16:29 ` Jens Axboe
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=20250617-isolcpus-queue-counters-v1-3-13923686b54b@kernel.org \
--to=wagi@kernel.org \
--cc=GR-QLogic-Storage-Upstream@marvell.com \
--cc=axboe@kernel.dk \
--cc=costa.shul@redhat.com \
--cc=frederic@kernel.org \
--cc=hare@suse.de \
--cc=hch@lst.de \
--cc=juri.lelli@redhat.com \
--cc=kbusch@kernel.org \
--cc=linux-block@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-nvme@lists.infradead.org \
--cc=linux-scsi@vger.kernel.org \
--cc=llong@redhat.com \
--cc=martin.petersen@oracle.com \
--cc=megaraidlinux.pdl@broadcom.com \
--cc=ming.lei@redhat.com \
--cc=mst@redhat.com \
--cc=sagi@grimberg.me \
--cc=storagedev@microchip.com \
--cc=tglx@linutronix.de \
--cc=virtualization@lists.linux.dev \
--cc=vschneid@redhat.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