From: Frank Seidel <fseidel@suse.de>
To: linux kernel <linux-kernel@vger.kernel.org>
Cc: akpm@linux-foundation.org,
"linux-wireless@vger.kernel.org" <linux-wireless@vger.kernel.org>,
"John W. Linville" <linville@tuxdriver.com>,
Zhu Yi <yi.zhu@intel.com>,
"Chatre, Reinette" <reinette.chatre@intel.com>,
Frank Seidel <fseidel@suse.de>, Frank Seidel <frank@f-seidel.de>,
kernalert.de@gmail.com, Mohamed Abbas <mohamed.abbas@intel.com>,
Tomas Winkler <tomas.winkler@intel.com>,
Abhijeet Kolekar <abhijeet.kolekar@intel.com>,
Johannes Berg <johannes@sipsolutions.net>
Subject: [PATCH] iwlwifi: reduce stack size
Date: Sun, 01 Mar 2009 20:25:38 +0100 [thread overview]
Message-ID: <49AAE132.8030403@suse.de> (raw)
From: Frank Seidel <frank@f-seidel.de>
Reduce stack memory footprint of iwlwifi.
(From >1000 bytes for each *_table_read
on i386 down to 32)
Signed-off-by: Frank Seidel <frank@f-seidel.de>
---
drivers/net/wireless/iwlwifi/iwl-3945-rs.c | 11 +++++++++--
drivers/net/wireless/iwlwifi/iwl-agn-rs.c | 23 +++++++++++++++++++----
2 files changed, 28 insertions(+), 6 deletions(-)
--- a/drivers/net/wireless/iwlwifi/iwl-3945-rs.c
+++ b/drivers/net/wireless/iwlwifi/iwl-3945-rs.c
@@ -815,11 +815,16 @@ static ssize_t iwl3945_sta_dbgfs_stats_t
char __user *user_buf,
size_t count, loff_t *ppos)
{
- char buff[1024];
+ char *buff;
int desc = 0;
int j;
+ ssize_t ret;
struct iwl3945_rs_sta *lq_sta = file->private_data;
+ buff = kmalloc(1024, GFP_KERNEL);
+ if (!buff)
+ return -ENOMEM;
+
desc += sprintf(buff + desc, "tx packets=%d last rate index=%d\n"
"rate=0x%X flush time %d\n",
lq_sta->tx_packets,
@@ -832,7 +837,9 @@ static ssize_t iwl3945_sta_dbgfs_stats_t
lq_sta->win[j].success_counter,
lq_sta->win[j].success_ratio);
}
- return simple_read_from_buffer(user_buf, count, ppos, buff, desc);
+ ret = simple_read_from_buffer(user_buf, count, ppos, buff, desc);
+ kfree(buff);
+ return ret;
}
static const struct file_operations rs_sta_dbgfs_stats_table_ops = {
--- a/drivers/net/wireless/iwlwifi/iwl-agn-rs.c
+++ b/drivers/net/wireless/iwlwifi/iwl-agn-rs.c
@@ -2474,12 +2474,17 @@ static ssize_t rs_sta_dbgfs_scale_table_
static ssize_t rs_sta_dbgfs_scale_table_read(struct file *file,
char __user *user_buf, size_t count, loff_t *ppos)
{
- char buff[1024];
+ char *buff;
int desc = 0;
int i = 0;
+ ssize_t ret;
struct iwl_lq_sta *lq_sta = file->private_data;
+ buff = kmalloc(1024, GFP_KERNEL);
+ if (!buff)
+ return -ENOMEM;
+
desc += sprintf(buff+desc, "sta_id %d\n", lq_sta->lq.sta_id);
desc += sprintf(buff+desc, "failed=%d success=%d rate=0%X\n",
lq_sta->total_failed, lq_sta->total_success,
@@ -2511,7 +2516,9 @@ static ssize_t rs_sta_dbgfs_scale_table_
desc += sprintf(buff+desc, " rate[%d] 0x%X\n",
i, le32_to_cpu(lq_sta->lq.rs_table[i].rate_n_flags));
- return simple_read_from_buffer(user_buf, count, ppos, buff, desc);
+ ret = simple_read_from_buffer(user_buf, count, ppos, buff, desc);
+ kfree(buff);
+ return ret;
}
static const struct file_operations rs_sta_dbgfs_scale_table_ops = {
@@ -2522,11 +2529,17 @@ static const struct file_operations rs_s
static ssize_t rs_sta_dbgfs_stats_table_read(struct file *file,
char __user *user_buf, size_t count, loff_t *ppos)
{
- char buff[1024];
+ char *buff;
int desc = 0;
int i, j;
+ ssize_t ret;
struct iwl_lq_sta *lq_sta = file->private_data;
+
+ buff = kmalloc(1024, GFP_KERNEL);
+ if (!buff)
+ return -ENOMEM;
+
for (i = 0; i < LQ_SIZE; i++) {
desc += sprintf(buff+desc, "%s type=%d SGI=%d FAT=%d DUP=%d\n"
"rate=0x%X\n",
@@ -2544,7 +2557,9 @@ static ssize_t rs_sta_dbgfs_stats_table_
lq_sta->lq_info[i].win[j].success_ratio);
}
}
- return simple_read_from_buffer(user_buf, count, ppos, buff, desc);
+ ret = simple_read_from_buffer(user_buf, count, ppos, buff, desc);
+ kfree(buff);
+ return ret;
}
static const struct file_operations rs_sta_dbgfs_stats_table_ops = {
next reply other threads:[~2009-03-01 19:25 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2009-03-01 19:25 Frank Seidel [this message]
2009-03-02 21:42 ` [PATCH] iwlwifi: reduce stack size reinette chatre
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=49AAE132.8030403@suse.de \
--to=fseidel@suse.de \
--cc=abhijeet.kolekar@intel.com \
--cc=akpm@linux-foundation.org \
--cc=frank@f-seidel.de \
--cc=johannes@sipsolutions.net \
--cc=kernalert.de@gmail.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-wireless@vger.kernel.org \
--cc=linville@tuxdriver.com \
--cc=mohamed.abbas@intel.com \
--cc=reinette.chatre@intel.com \
--cc=tomas.winkler@intel.com \
--cc=yi.zhu@intel.com \
/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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.