megaraid_sas: Reduce stack usage in megasas_probe_one()
PATCH 1/1 megaraid_sas: Reduce stack usage in megasas_probe_one()
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.
--- 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:
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