diff options
author | Sreekanth Reddy <sreekanth.reddy@broadcom.com> | 2021-02-01 15:15:22 +0100 |
---|---|---|
committer | Martin K. Petersen <martin.petersen@oracle.com> | 2021-02-09 03:53:12 +0100 |
commit | d309ae07327d19ce613629a0535e9a11a8ff5127 (patch) | |
tree | d4b8c762e839035853a060e63a5d94db1e70999a /drivers/scsi | |
parent | scsi: pmcraid: Fix 'ioarcb' alignment warning (diff) | |
download | linux-d309ae07327d19ce613629a0535e9a11a8ff5127.tar.xz linux-d309ae07327d19ce613629a0535e9a11a8ff5127.zip |
scsi: mpt3sas: Fix ReplyPostFree pool allocation
Currently the driver allocates memory for ReplyPostFree queues in chunks of
16. In resource constrained environments--such as VM with 1 GB RAM and 2
CPUs--memory allocation for ReplyPostFree pools may fail because the driver
tries to allocate a memory for 16 ReplyPostFree queues even though the
actual number needed is 2.
Change the driver to allocate memory for only the actual number of queues
needed if the ReplyPostFree queue count is less than 16.
Link: https://lore.kernel.org/r/20210201141522.25363-1-sreekanth.reddy@broadcom.com
Signed-off-by: Sreekanth Reddy <sreekanth.reddy@broadcom.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
Diffstat (limited to 'drivers/scsi')
-rw-r--r-- | drivers/scsi/mpt3sas/mpt3sas_base.c | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/drivers/scsi/mpt3sas/mpt3sas_base.c b/drivers/scsi/mpt3sas/mpt3sas_base.c index f5582c8e77c9..e2455b9c575e 100644 --- a/drivers/scsi/mpt3sas/mpt3sas_base.c +++ b/drivers/scsi/mpt3sas/mpt3sas_base.c @@ -5641,7 +5641,8 @@ _base_allocate_memory_pools(struct MPT3SAS_ADAPTER *ioc) reply_post_free_sz = ioc->reply_post_queue_depth * sizeof(Mpi2DefaultReplyDescriptor_t); rdpq_sz = reply_post_free_sz * RDPQ_MAX_INDEX_IN_ONE_CHUNK; - if (_base_is_controller_msix_enabled(ioc) && !ioc->rdpq_array_enable) + if ((_base_is_controller_msix_enabled(ioc) && !ioc->rdpq_array_enable) + || (ioc->reply_queue_count < RDPQ_MAX_INDEX_IN_ONE_CHUNK)) rdpq_sz = reply_post_free_sz * ioc->reply_queue_count; ret = base_alloc_rdpq_dma_pool(ioc, rdpq_sz); if (ret == -EAGAIN) { |