| To: | Jeff Garzik <jgarzik@xxxxxxxxx> |
|---|---|
| Subject: | [PATCH] reduce stack usage in ixgb_ethtool_ioctl |
| From: | Denis Vlasenko <vda@xxxxxxxxxxxxxxxxxxxxxxxxxxxxxx> |
| Date: | Sun, 19 Sep 2004 20:33:56 +0300 |
| Cc: | linux-kernel@xxxxxxxxxxxxxxx, netdev@xxxxxxxxxxx |
| Sender: | netdev-bounce@xxxxxxxxxxx |
| User-agent: | KMail/1.5.4 |
Stack usage reduced from 3024 (!) to 576.
Most of those 3k came from a bug:
#define IXGB_REG_DUMP_LEN 136*sizeof(uint32_t)
^^^^^^^^^^^^^^^^^
...
uint32_t regs_buff[IXGB_REG_DUMP_LEN];
Bug fixed. Two large on-stack variables moved to kmalloc space.
Stack usage is still high because gcc will
allocate too much space for these cases:
case ETHTOOL_GSET:{
struct ethtool_cmd ecmd = { ETHTOOL_GSET };
ixgb_ethtool_gset(adapter, &ecmd);
if (copy_to_user(addr, &ecmd, sizeof(ecmd)))
return -EFAULT;
return 0;
}
case ETHTOOL_SSET:{
struct ethtool_cmd ecmd;
if (copy_from_user(&ecmd, addr, sizeof(ecmd)))
return -EFAULT;
return ixgb_ethtool_sset(adapter, &ecmd);
}
There will be space for _two_ ecmd's on stack.
Shall it be worked around with ugly union of structs
or we'll just wait for better gcc?
Compile-tested only.
--
vda
|
| <Prev in Thread] | Current Thread | [Next in Thread> |
|---|---|---|
| ||
| Previous by Date: | Re: [PATCH] Improve behaviour of Netlink Sockets, Herbert Xu |
|---|---|
| Next by Date: | Re: [PATCH] reduce stack usage in ixgb_ethtool_ioctl, Dave Dillow |
| Previous by Thread: | [PATCH 2.6] fix zombie netlink socket in user space, Pablo Neira |
| Next by Thread: | Re: [PATCH] reduce stack usage in ixgb_ethtool_ioctl, Dave Dillow |
| Indexes: | [Date] [Thread] [Top] [All Lists] |