Skip to content

Commit 17c3316

Browse files
committed
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 <[email protected]> Signed-off-by: Keith Busch <[email protected]>
1 parent 3f68baf commit 17c3316

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

drivers/nvme/host/pci.c

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3138,6 +3138,9 @@ static int __init nvme_init(void)
31383138
BUILD_BUG_ON(sizeof(struct nvme_create_sq) != 64);
31393139
BUILD_BUG_ON(sizeof(struct nvme_delete_queue) != 64);
31403140
BUILD_BUG_ON(IRQ_AFFINITY_MAX_SETS < 2);
3141+
3142+
write_queues = min(write_queues, num_possible_cpus());
3143+
poll_queues = min(poll_queues, num_possible_cpus());
31413144
return pci_register_driver(&nvme_driver);
31423145
}
31433146

0 commit comments

Comments
 (0)