public inbox for linux-scsi@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH]megaraid_sas: Reduce stack usage in megasas_probe_one()
@ 2005-04-20  7:59 Yum Rayan
  2005-04-20 16:26 ` Randy.Dunlap
  0 siblings, 1 reply; 3+ messages in thread
From: Yum Rayan @ 2005-04-20  7:59 UTC (permalink / raw)
  To: Sreenivas.Bagalkote; +Cc: linux-scsi

This patch reduces stack usage in megasas_probe_one() from to 2200 to
156. A patched version of gcc 3.4.3 with -fno-unit-at-a-time disabled
was used on i386 platform.

Signed-off-by: Yum Rayan <yum.rayan@gmail.com>

--- linux-2.6.12-rc2-mm3.a/drivers/scsi/megaraid/megaraid_sas.c	2005-04-14
22:15:44.000000000 -0700
+++ linux-2.6.12-rc2-mm3.b/drivers/scsi/megaraid/megaraid_sas.c	2005-04-20
00:26:01.000000000 -0700
@@ -731,7 +731,7 @@
 	struct megasas_register_set*	reg_set;
 
 	struct megasas_cmd*		cmd;
-	struct megasas_ctrl_info	ctrl_info;
+	struct megasas_ctrl_info	*ctrl_info;
 
 	struct megasas_init_frame*	init_frame;
 	struct megasas_init_queue_info*	initq_info;
@@ -846,15 +846,19 @@
 
 	megasas_return_cmd( instance, cmd );
 
+	ctrl_info = kmalloc(sizeof(struct megasas_ctrl_info), GFP_KERNEL);
+
 	/*
 	 * Gather misc FW related information
 	 */
-	if (!megasas_get_ctrl_info( instance, &ctrl_info ))
-		instance->max_sectors_per_req = ctrl_info.max_request_size;
+	if (ctrl_info && !megasas_get_ctrl_info( instance, ctrl_info ))
+		instance->max_sectors_per_req = ctrl_info->max_request_size;
 	else
 		instance->max_sectors_per_req = instance->max_num_sge *
 						PAGE_SIZE / 512;
 
+	kfree(ctrl_info);
+
 	return 0;
 
 fail_fw_init:

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

* RE: [PATCH]megaraid_sas: Reduce stack usage in megasas_probe_one( )
@ 2005-04-20 14:05 Bagalkote, Sreenivas
  0 siblings, 0 replies; 3+ messages in thread
From: Bagalkote, Sreenivas @ 2005-04-20 14:05 UTC (permalink / raw)
  To: 'Yum Rayan'; +Cc: linux-scsi

>
>This patch reduces stack usage in megasas_probe_one() from to 2200 to
>156. A patched version of gcc 3.4.3 with -fno-unit-at-a-time disabled
>was used on i386 platform.
>
>Signed-off-by: Yum Rayan <yum.rayan@gmail.com>

Rayan,

Thanks. I will be submitting shortly a consolidated patch that includes
changes suggested by Matt, Adrian and others. I will merge your patch
into mine.

Thanks,
Sreenivas Bagalkote
LSI Logic Corporation

>
>--- 
>linux-2.6.12-rc2-mm3.a/drivers/scsi/megaraid/megaraid_sas.c	
>2005-04-14
>22:15:44.000000000 -0700
>+++ 
>linux-2.6.12-rc2-mm3.b/drivers/scsi/megaraid/megaraid_sas.c	
>2005-04-20
>00:26:01.000000000 -0700
>@@ -731,7 +731,7 @@
> 	struct megasas_register_set*	reg_set;
> 
> 	struct megasas_cmd*		cmd;
>-	struct megasas_ctrl_info	ctrl_info;
>+	struct megasas_ctrl_info	*ctrl_info;
> 
> 	struct megasas_init_frame*	init_frame;
> 	struct megasas_init_queue_info*	initq_info;
>@@ -846,15 +846,19 @@
> 
> 	megasas_return_cmd( instance, cmd );
> 
>+	ctrl_info = kmalloc(sizeof(struct megasas_ctrl_info), 
>GFP_KERNEL);
>+
> 	/*
> 	 * Gather misc FW related information
> 	 */
>-	if (!megasas_get_ctrl_info( instance, &ctrl_info ))
>-		instance->max_sectors_per_req = 
>ctrl_info.max_request_size;
>+	if (ctrl_info && !megasas_get_ctrl_info( instance, ctrl_info ))
>+		instance->max_sectors_per_req = 
>ctrl_info->max_request_size;
> 	else
> 		instance->max_sectors_per_req = instance->max_num_sge *
> 						PAGE_SIZE / 512;
> 
>+	kfree(ctrl_info);
>+
> 	return 0;
> 
> fail_fw_init:
>

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

* Re: [PATCH]megaraid_sas: Reduce stack usage in megasas_probe_one()
  2005-04-20  7:59 [PATCH]megaraid_sas: Reduce stack usage in megasas_probe_one() Yum Rayan
@ 2005-04-20 16:26 ` Randy.Dunlap
  0 siblings, 0 replies; 3+ messages in thread
From: Randy.Dunlap @ 2005-04-20 16:26 UTC (permalink / raw)
  To: Yum Rayan; +Cc: Sreenivas.Bagalkote, linux-scsi

On Wed, 20 Apr 2005 00:59:43 -0700 Yum Rayan wrote:

| This patch reduces stack usage in megasas_probe_one() from to 2200 to
| 156. A patched version of gcc 3.4.3 with -fno-unit-at-a-time disabled
| was used on i386 platform.

Hi Yum,

In the future, please use "diff -up" (or even more options,
but please add the 'p') so that we can easily see what functions
or structs the modifications are in.

Check Documentation/SubmittingPatches:

1) "diff -up"
------------
Use "diff -up" or "diff -uprN" to create patches.


diffstat output would also be a good addition.

Thanks,
---
~Randy

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

end of thread, other threads:[~2005-04-20 16:27 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2005-04-20  7:59 [PATCH]megaraid_sas: Reduce stack usage in megasas_probe_one() Yum Rayan
2005-04-20 16:26 ` Randy.Dunlap
  -- strict thread matches above, loose matches on Subject: below --
2005-04-20 14:05 [PATCH]megaraid_sas: Reduce stack usage in megasas_probe_one( ) Bagalkote, Sreenivas

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox