scsi: mpt3sas: Fix ReplyPostFree pool allocation
authorSreekanth Reddy <sreekanth.reddy@broadcom.com>
Mon, 1 Feb 2021 14:15:22 +0000 (19:45 +0530)
committerMartin K. Petersen <martin.petersen@oracle.com>
Tue, 9 Feb 2021 02:53:12 +0000 (21:53 -0500)
commitd309ae07327d19ce613629a0535e9a11a8ff5127
treed4b8c762e839035853a060e63a5d94db1e70999a
parente92b0b5edfc7c83bd2d791929aa4e0c89ac029aa
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>
drivers/scsi/mpt3sas/mpt3sas_base.c