]> asedeno.scripts.mit.edu Git - linux.git/commitdiff
nvme/pci Limit write queue sizes to possible cpus
authorKeith Busch <kbusch@kernel.org>
Fri, 6 Dec 2019 16:16:59 +0000 (01:16 +0900)
committerKeith Busch <kbusch@kernel.org>
Fri, 6 Dec 2019 17:52:42 +0000 (02:52 +0900)
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>
drivers/nvme/host/pci.c

index 446ea9c175fe8b490bfc0904c9c8ca9465b13ca2..fe81e1581e5f3402299511acd1a5166d0f6024f5 100644 (file)
@@ -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);
 }