diff options
author | Keith Busch <kbusch@kernel.org> | 2019-12-07 01:16:59 +0900 |
---|---|---|
committer | Keith Busch <kbusch@kernel.org> | 2019-12-07 02:52:42 +0900 |
commit | 17c3316734ae2e51f74078cd955ab855caea7d73 (patch) | |
tree | c835b462039608025e1170ea0c14bc39cd726bbf /drivers/nvme/host | |
parent | 3f68baf706ec68c4120867c25bc439c845fe3e17 (diff) | |
download | linux-17c3316734ae2e51f74078cd955ab855caea7d73.tar.gz linux-17c3316734ae2e51f74078cd955ab855caea7d73.tar.bz2 linux-17c3316734ae2e51f74078cd955ab855caea7d73.zip |
nvme/pci Limit write queue sizes to possible cpus
The driver can never use more queues of any type than the number of
possible CPUs, so a higher value causes the driver to allocate more
memory for IO queues than it could ever use. Limit the parameter at
module load time to the number of possible cpus.
Reviewed-by: Jens Axboe <axboe@kernel.dk>
Signed-off-by: Keith Busch <kbusch@kernel.org>
Diffstat (limited to 'drivers/nvme/host')
-rw-r--r-- | drivers/nvme/host/pci.c | 3 |
1 files changed, 3 insertions, 0 deletions
diff --git a/drivers/nvme/host/pci.c b/drivers/nvme/host/pci.c index 446ea9c175fe..fe81e1581e5f 100644 --- a/drivers/nvme/host/pci.c +++ b/drivers/nvme/host/pci.c @@ -3138,6 +3138,9 @@ static int __init nvme_init(void) BUILD_BUG_ON(sizeof(struct nvme_create_sq) != 64); BUILD_BUG_ON(sizeof(struct nvme_delete_queue) != 64); BUILD_BUG_ON(IRQ_AFFINITY_MAX_SETS < 2); + + write_queues = min(write_queues, num_possible_cpus()); + poll_queues = min(poll_queues, num_possible_cpus()); return pci_register_driver(&nvme_driver); } |