mpt3sas: fix ReplyPostFree pool allocation
Subsystems (2)
Sreekanth Reddy
maintainerPATCH 1/1 mpt3sas: fix ReplyPostFree pool allocation
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.
--- drivers/scsi/mpt3sas/mpt3sas_base.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
drivers/scsi/mpt3sas/mpt3sas_base.c +2 -1
@@ -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 ) {
Signature · 1 line
2.27.0
Martin K. Petersen
AppliedSreekanth,
Quoted 8 lines
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!
Signature · 1 line
Martin K. Petersen Oracle Linux Engineering