All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] mpt3sas: fix ReplyPostFree pool allocation
@ 2021-02-01 14:15 Sreekanth Reddy
  2021-02-09  2:20 ` Martin K. Petersen
  0 siblings, 1 reply; 2+ messages in thread
From: Sreekanth Reddy @ 2021-02-01 14:15 UTC (permalink / raw)
  To: martin.petersen
  Cc: linux-scsi, sathya.prakash, suganath-prabu.subramani, Sreekanth Reddy

[-- Attachment #1: Type: text/plain, Size: 1467 bytes --]

Currently driver allocate memory for ReplyPostFree queues in
chunks of 16 ReplyPostFree queue count.
On less resource environment such as VM with 1GB and two CPUs,
memory allocation for ReplyPostFree pools may fail, since
driver tries to allocate a memory for 16 ReplyPostFree queue count
even though the actual number of ReplyPostFree queue used is two.
Now, the driver will allocate memory for only the actual number of
ReplyPostFree queues instead for 16 queues if the ReplyPostFree
queue count is less than 16.

Signed-off-by: Sreekanth Reddy <sreekanth.reddy@broadcom.com>
---
 drivers/scsi/mpt3sas/mpt3sas_base.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/drivers/scsi/mpt3sas/mpt3sas_base.c b/drivers/scsi/mpt3sas/mpt3sas_base.c
index f5582c8..e2455b9 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) {
-- 
2.27.0


[-- Attachment #2: S/MIME Cryptographic Signature --]
[-- Type: application/pkcs7-signature, Size: 4175 bytes --]

^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH] mpt3sas: fix ReplyPostFree pool allocation
  2021-02-01 14:15 [PATCH] mpt3sas: fix ReplyPostFree pool allocation Sreekanth Reddy
@ 2021-02-09  2:20 ` Martin K. Petersen
  0 siblings, 0 replies; 2+ messages in thread
From: Martin K. Petersen @ 2021-02-09  2:20 UTC (permalink / raw)
  To: Sreekanth Reddy
  Cc: martin.petersen, linux-scsi, sathya.prakash, suganath-prabu.subramani


Sreekanth,

> Currently driver allocate memory for ReplyPostFree queues in chunks of
> 16 ReplyPostFree queue count.  On less resource environment such as VM
> with 1GB and two CPUs, memory allocation for ReplyPostFree pools may
> fail, since driver tries to allocate a memory for 16 ReplyPostFree
> queue count even though the actual number of ReplyPostFree queue used
> is two.  Now, the driver will allocate memory for only the actual
> number of ReplyPostFree queues instead for 16 queues if the
> ReplyPostFree queue count is less than 16.

Applied to 5.12/scsi-staging, thanks!

-- 
Martin K. Petersen	Oracle Linux Engineering

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2021-02-09  2:21 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-02-01 14:15 [PATCH] mpt3sas: fix ReplyPostFree pool allocation Sreekanth Reddy
2021-02-09  2:20 ` Martin K. Petersen

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.