Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1336269 > unrolled thread

[PATCH 1/2] mpt3sas: Deallocate resources before trying reallocation of the same in _base_allocate_memory_pools()

Started byChaitra P B <chaitra.basappa@broadcom.com>
First post2016-02-17 12:30 +0100
Last post2016-02-18 01:00 +0100
Articles 4 — 4 participants

Back to article view | Back to linux.kernel

This discussion starts older than the indexed window; earlier articles aren't shown. The article labeled Started by below is the oldest one visible, not the original post.


Contents

  [PATCH 1/2] mpt3sas: Deallocate resources before trying reallocation of the same in _base_allocate_memory_pools() Chaitra P B <chaitra.basappa@broadcom.com> - 2016-02-17 12:30 +0100
    Re: [PATCH 1/2] mpt3sas: Deallocate resources before trying  reallocation of the same in _base_allocate_memory_pools() Johannes Thumshirn <jthumshirn@suse.de> - 2016-02-17 12:40 +0100
      Re: [PATCH 1/2] mpt3sas: Deallocate resources before trying  reallocation of the same in _base_allocate_memory_pools() Tomas Henzl <thenzl@redhat.com> - 2016-02-17 17:50 +0100
    Re: [PATCH 1/2] mpt3sas: Deallocate resources before trying reallocation of the same in _base_allocate_memory_pools() "Martin K. Petersen" <martin.petersen@oracle.com> - 2016-02-18 01:00 +0100

#1336269 — [PATCH 1/2] mpt3sas: Deallocate resources before trying reallocation of the same in _base_allocate_memory_pools()

FromChaitra P B <chaitra.basappa@broadcom.com>
Date2016-02-17 12:30 +0100
Subject[PATCH 1/2] mpt3sas: Deallocate resources before trying reallocation of the same in _base_allocate_memory_pools()
Message-ID<r38sX-5EQ-27@gated-at.bofh.it>
Deallocates resources before reallocating of the same in retry_allocation
path of _base_allocate_memory_pools()

Signed-off-by: Chaitra P B <chaitra.basappa@broadcom.com>
Suganath prabu Subramani <suganath-prabu.subramani@avagotech.com>
---
 drivers/scsi/mpt3sas/mpt3sas_base.c | 7 +++++--
 1 file changed, 5 insertions(+), 2 deletions(-)

diff --git a/drivers/scsi/mpt3sas/mpt3sas_base.c b/drivers/scsi/mpt3sas/mpt3sas_base.c
index f59495b..60c2e86 100644
--- a/drivers/scsi/mpt3sas/mpt3sas_base.c
+++ b/drivers/scsi/mpt3sas/mpt3sas_base.c
@@ -3124,8 +3124,10 @@ _base_release_memory_pools(struct MPT3SAS_ADAPTER *ioc)
 		free_pages((ulong)ioc->scsi_lookup, ioc->scsi_lookup_pages);
 		ioc->scsi_lookup = NULL;
 	}
-	kfree(ioc->hpr_lookup);
-	kfree(ioc->internal_lookup);
+	if (ioc->hpr_lookup)
+		kfree(ioc->hpr_lookup);
+	if (ioc->internal_lookup)
+		kfree(ioc->internal_lookup);
 	if (ioc->chain_lookup) {
 		for (i = 0; i < ioc->chain_depth; i++) {
 			if (ioc->chain_lookup[i].chain_buffer)
@@ -3360,6 +3362,7 @@ _base_allocate_memory_pools(struct MPT3SAS_ADAPTER *ioc,  int sleep_flag)
 			goto out;
 		retry_sz += 64;
 		ioc->hba_queue_depth = max_request_credit - retry_sz;
+		_base_release_memory_pools(ioc);
 		goto retry_allocation;
 	}
 
-- 
1.8.3.1

[toc] | [next] | [standalone]


#1336280 — Re: [PATCH 1/2] mpt3sas: Deallocate resources before trying reallocation of the same in _base_allocate_memory_pools()

FromJohannes Thumshirn <jthumshirn@suse.de>
Date2016-02-17 12:40 +0100
SubjectRe: [PATCH 1/2] mpt3sas: Deallocate resources before trying reallocation of the same in _base_allocate_memory_pools()
Message-ID<r38CC-5Js-19@gated-at.bofh.it>
In reply to#1336269
On Wed, Feb 17, 2016 at 04:55:25PM +0530, Chaitra P B wrote:
> Deallocates resources before reallocating of the same in retry_allocation
> path of _base_allocate_memory_pools()
> 
> Signed-off-by: Chaitra P B <chaitra.basappa@broadcom.com>
> Suganath prabu Subramani <suganath-prabu.subramani@avagotech.com>
> ---
>  drivers/scsi/mpt3sas/mpt3sas_base.c | 7 +++++--
>  1 file changed, 5 insertions(+), 2 deletions(-)
> 
> diff --git a/drivers/scsi/mpt3sas/mpt3sas_base.c b/drivers/scsi/mpt3sas/mpt3sas_base.c
> index f59495b..60c2e86 100644
> --- a/drivers/scsi/mpt3sas/mpt3sas_base.c
> +++ b/drivers/scsi/mpt3sas/mpt3sas_base.c
> @@ -3124,8 +3124,10 @@ _base_release_memory_pools(struct MPT3SAS_ADAPTER *ioc)
>  		free_pages((ulong)ioc->scsi_lookup, ioc->scsi_lookup_pages);
>  		ioc->scsi_lookup = NULL;
>  	}
> -	kfree(ioc->hpr_lookup);
> -	kfree(ioc->internal_lookup);
> +	if (ioc->hpr_lookup)
> +		kfree(ioc->hpr_lookup);
> +	if (ioc->internal_lookup)
> +		kfree(ioc->internal_lookup);

kfree() can handle NULL pointers as arguments, so checking isn't needed. In
fact there are coccinelle scripts to check for it (make coccicheck) and it'll
spawn patches from people "fixing" it. So please get rid of the checks.

Otherwise

Reviewed-by: Johannes Thumshirn <jthumshirn@suse.de>

>  	if (ioc->chain_lookup) {
>  		for (i = 0; i < ioc->chain_depth; i++) {
>  			if (ioc->chain_lookup[i].chain_buffer)
> @@ -3360,6 +3362,7 @@ _base_allocate_memory_pools(struct MPT3SAS_ADAPTER *ioc,  int sleep_flag)
>  			goto out;
>  		retry_sz += 64;
>  		ioc->hba_queue_depth = max_request_credit - retry_sz;
> +		_base_release_memory_pools(ioc);
>  		goto retry_allocation;
>  	}
>  
> -- 
> 1.8.3.1
> 
> --
> To unsubscribe from this list: send the line "unsubscribe linux-scsi" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html

-- 
Johannes Thumshirn                                          Storage
jthumshirn@suse.de                                +49 911 74053 689
SUSE LINUX GmbH, Maxfeldstr. 5, 90409 Nürnberg
GF: Felix Imendörffer, Jane Smithard, Graham Norton
HRB 21284 (AG Nürnberg)
Key fingerprint = EC38 9CAB C2C4 F25D 8600 D0D0 0393 969D 2D76 0850

[toc] | [prev] | [next] | [standalone]


#1336572 — Re: [PATCH 1/2] mpt3sas: Deallocate resources before trying reallocation of the same in _base_allocate_memory_pools()

FromTomas Henzl <thenzl@redhat.com>
Date2016-02-17 17:50 +0100
SubjectRe: [PATCH 1/2] mpt3sas: Deallocate resources before trying reallocation of the same in _base_allocate_memory_pools()
Message-ID<r3dsC-BT-7@gated-at.bofh.it>
In reply to#1336280
On 17.2.2016 12:36, Johannes Thumshirn wrote:
> On Wed, Feb 17, 2016 at 04:55:25PM +0530, Chaitra P B wrote:
>> Deallocates resources before reallocating of the same in retry_allocation
>> path of _base_allocate_memory_pools()
>>
>> Signed-off-by: Chaitra P B <chaitra.basappa@broadcom.com>
>> Suganath prabu Subramani <suganath-prabu.subramani@avagotech.com>
>> ---
>>  drivers/scsi/mpt3sas/mpt3sas_base.c | 7 +++++--
>>  1 file changed, 5 insertions(+), 2 deletions(-)
>>
>> diff --git a/drivers/scsi/mpt3sas/mpt3sas_base.c b/drivers/scsi/mpt3sas/mpt3sas_base.c
>> index f59495b..60c2e86 100644
>> --- a/drivers/scsi/mpt3sas/mpt3sas_base.c
>> +++ b/drivers/scsi/mpt3sas/mpt3sas_base.c
>> @@ -3124,8 +3124,10 @@ _base_release_memory_pools(struct MPT3SAS_ADAPTER *ioc)
>>  		free_pages((ulong)ioc->scsi_lookup, ioc->scsi_lookup_pages);
>>  		ioc->scsi_lookup = NULL;
>>  	}
>> -	kfree(ioc->hpr_lookup);
>> -	kfree(ioc->internal_lookup);
>> +	if (ioc->hpr_lookup)
>> +		kfree(ioc->hpr_lookup);
>> +	if (ioc->internal_lookup)
>> +		kfree(ioc->internal_lookup);
> kfree() can handle NULL pointers as arguments, so checking isn't needed. In
> fact there are coccinelle scripts to check for it (make coccicheck) and it'll
> spawn patches from people "fixing" it. So please get rid of the checks.
>
> Otherwise
>
> Reviewed-by: Johannes Thumshirn <jthumshirn@suse.de>
>
>>  	if (ioc->chain_lookup) {
>>  		for (i = 0; i < ioc->chain_depth; i++) {
>>  			if (ioc->chain_lookup[i].chain_buffer)
>> @@ -3360,6 +3362,7 @@ _base_allocate_memory_pools(struct MPT3SAS_ADAPTER *ioc,  int sleep_flag)
>>  			goto out;
>>  		retry_sz += 64;
>>  		ioc->hba_queue_depth = max_request_credit - retry_sz;
>> +		_base_release_memory_pools(ioc);
>>  		goto retry_allocation;

Thanks for posting

Reviewed-by: Tomas Henzl <thenzl@redhat.com>

[toc] | [prev] | [next] | [standalone]


#1336891

From"Martin K. Petersen" <martin.petersen@oracle.com>
Date2016-02-18 01:00 +0100
Message-ID<r3kaK-5hs-5@gated-at.bofh.it>
In reply to#1336269
>>>>> "Chaitra" == Chaitra P B <chaitra.basappa@broadcom.com> writes:

Chaitra> Deallocates resources before reallocating of the same in
Chaitra> retry_allocation path of _base_allocate_memory_pools()

Johannes' comments about kfree() aside, this patch does not apply to
4.6/scsi-queue which has the driver update from Suganath. Please rebase
and resubmit.

-- 
Martin K. Petersen	Oracle Linux Engineering

[toc] | [prev] | [standalone]


Back to top | Article view | linux.kernel


csiph-web