• James Smart's avatar
    scsi: lpfc: Mitigate high memory pre-allocation by SCSI-MQ · 77ffd346
    James Smart authored
    When SCSI-MQ is enabled, the SCSI-MQ layers will do pre-allocation of MQ
    resources based on shost values set by the driver. In newer cases of the
    driver, which attempts to set nr_hw_queues to the cpu count, the
    multipliers become excessive, with a single shost having SCSI-MQ
    pre-allocation reaching into the multiple GBytes range.  NPIV, which
    creates additional shosts, only multiply this overhead. On lower-memory
    systems, this can exhaust system memory very quickly, resulting in a system
    crash or failures in the driver or elsewhere due to low memory conditions.
    
    After testing several scenarios, the situation can be mitigated by limiting
    the value set in shost->nr_hw_queues to 4. Although the shost values were
    changed, the driver still had per-cpu hardware queues of its own that
    allowed parallelization per-cpu.  Testing revealed that even with the
    smallish number for nr_hw_queues for SCSI-MQ, performance levels remained
    near maximum with the within-driver affiinitization.
    
    A module parameter was created to allow the value set for the nr_hw_queues
    to be tunable.
    Signed-off-by: default avatarDick Kennedy <dick.kennedy@broadcom.com>
    Signed-off-by: default avatarJames Smart <jsmart2021@gmail.com>
    Reviewed-by: default avatarMing Lei <ming.lei@redhat.com>
    Reviewed-by: default avatarEwan D. Milne <emilne@redhat.com>
    Signed-off-by: default avatarMartin K. Petersen <martin.petersen@oracle.com>
    77ffd346
lpfc.h 42.7 KB