]> git.ipfire.org Git - thirdparty/linux.git/commitdiff
scsi: qla2xxx: Use nr_cpu_ids instead of NR_CPUS for qp_cpu_map allocation
authorLi RongQing <lirongqing@baidu.com>
Tue, 31 Mar 2026 05:32:45 +0000 (01:32 -0400)
committerMartin K. Petersen <martin.petersen@oracle.com>
Thu, 9 Apr 2026 02:33:39 +0000 (22:33 -0400)
Change the memory allocation for qp_cpu_map to use the actual number of
CPUs ('nr_cpu_ids') instead of the maximum possible CPUs ('NR_CPUS').
This saves memory on systems where the maximum CPU limit is much higher
than the active CPU count.

Signed-off-by: Li RongQing <lirongqing@baidu.com>
Link: https://patch.msgid.link/20260331053245.1839-1-lirongqing@baidu.com
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
drivers/scsi/qla2xxx/qla_inline.h

index 53eaff1e0f65c4d86bd6f8595d1f714fb7ac29f6..47fbd830ff163055f45653158045c973e64e6fa7 100644 (file)
@@ -621,7 +621,7 @@ static inline int qla_mapq_alloc_qp_cpu_map(struct qla_hw_data *ha)
        scsi_qla_host_t *vha = pci_get_drvdata(ha->pdev);
 
        if (!ha->qp_cpu_map) {
-               ha->qp_cpu_map = kzalloc_objs(struct qla_qpair *, NR_CPUS);
+               ha->qp_cpu_map = kzalloc_objs(struct qla_qpair *, nr_cpu_ids);
                if (!ha->qp_cpu_map) {
                        ql_log(ql_log_fatal, vha, 0x0180,
                               "Unable to allocate memory for qp_cpu_map ptrs.\n");