From: Frank Seidel <fseidel@suse.de>
To: linux kernel <linux-kernel@vger.kernel.org>
Cc: akpm@linux-foundation.org, minyard@acm.org,
openipmi-developer@lists.sourceforge.net,
Frank Seidel <fseidel@suse.de>, Frank Seidel <fseidel@suse.de>,
kernalert.de@gmail.com, djwong@us.ibm.com,
Adrian Bunk <bunk@kernel.org>,
Alexey Dobriyan <adobriyan@gmail.com>,
cminyard@mvista.com, kbaidarov@ru.mvista.com, crquan@gmail.com
Subject: [PATCH] ipmi: reduce stack size of msghandler
Date: Wed, 04 Mar 2009 13:22:12 +0100 [thread overview]
Message-ID: <49AE7274.2080206@suse.de> (raw)
From: Frank Seidel <frank@f-seidel.de>
Reduce stack memory footprint in ipmi_msghandler
for send_panic_events. (From 992 bytes on i386
down to below 100)
Signed-off-by: Frank Seidel <frank@f-seidel.de>
---
drivers/char/ipmi/ipmi_msghandler.c | 39 ++++++++++++++++++++++++------------
1 file changed, 27 insertions(+), 12 deletions(-)
--- a/drivers/char/ipmi/ipmi_msghandler.c
+++ b/drivers/char/ipmi/ipmi_msghandler.c
@@ -4001,8 +4001,20 @@ static void send_panic_events(char *str)
unsigned char data[16];
struct ipmi_system_interface_addr *si;
struct ipmi_addr addr;
- struct ipmi_smi_msg smi_msg;
- struct ipmi_recv_msg recv_msg;
+ struct ipmi_smi_msg *smi_msg;
+ struct ipmi_recv_msg *recv_msg;
+
+ smi_msg = kmalloc(sizeof(*smi_msg), GFP_KERNEL);
+ recv_msg = kmalloc(sizeof(*recv_msg), GFP_KERNEL);
+
+ if (!smi_msg || !recv_msg) {
+ printk(KERN_ERR PFX "Could not allocate memory\n");
+ if (smi_msg)
+ kfree(smi_msg);
+ else if (recv_msg)
+ kfree(recv_msg);
+ return;
+ }
si = (struct ipmi_system_interface_addr *) &addr;
si->addr_type = IPMI_SYSTEM_INTERFACE_ADDR_TYPE;
@@ -4030,8 +4042,8 @@ static void send_panic_events(char *str)
data[7] = str[2];
}
- smi_msg.done = dummy_smi_done_handler;
- recv_msg.done = dummy_recv_done_handler;
+ smi_msg->done = dummy_smi_done_handler;
+ recv_msg->done = dummy_recv_done_handler;
/* For every registered interface, send the event. */
list_for_each_entry_rcu(intf, &ipmi_interfaces, link) {
@@ -4048,8 +4060,8 @@ static void send_panic_events(char *str)
0,
&msg,
intf,
- &smi_msg,
- &recv_msg,
+ smi_msg,
+ recv_msg,
0,
intf->channels[0].address,
intf->channels[0].lun,
@@ -4107,8 +4119,8 @@ static void send_panic_events(char *str)
0,
&msg,
intf,
- &smi_msg,
- &recv_msg,
+ smi_msg,
+ recv_msg,
0,
intf->channels[0].address,
intf->channels[0].lun,
@@ -4127,8 +4139,8 @@ static void send_panic_events(char *str)
0,
&msg,
intf,
- &smi_msg,
- &recv_msg,
+ smi_msg,
+ recv_msg,
0,
intf->channels[0].address,
intf->channels[0].lun,
@@ -4195,8 +4207,8 @@ static void send_panic_events(char *str)
0,
&msg,
intf,
- &smi_msg,
- &recv_msg,
+ smi_msg,
+ recv_msg,
0,
intf->channels[0].address,
intf->channels[0].lun,
@@ -4204,6 +4216,9 @@ static void send_panic_events(char *str)
}
}
#endif /* CONFIG_IPMI_PANIC_STRING */
+
+ kfree(smi_msg);
+ kfree(recv_msg);
}
#endif /* CONFIG_IPMI_PANIC_EVENT */
next reply other threads:[~2009-03-04 12:22 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2009-03-04 12:22 Frank Seidel [this message]
2009-03-04 14:59 ` [PATCH] ipmi: reduce stack size of msghandler Corey Minyard
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=49AE7274.2080206@suse.de \
--to=fseidel@suse.de \
--cc=adobriyan@gmail.com \
--cc=akpm@linux-foundation.org \
--cc=bunk@kernel.org \
--cc=cminyard@mvista.com \
--cc=crquan@gmail.com \
--cc=djwong@us.ibm.com \
--cc=kbaidarov@ru.mvista.com \
--cc=kernalert.de@gmail.com \
--cc=linux-kernel@vger.kernel.org \
--cc=minyard@acm.org \
--cc=openipmi-developer@lists.sourceforge.net \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox