I noticed, that on a 32bit box with a non-debug config the
sizeof(struct net_device) is slightly more than 1024. This
means, that for example loopback device (with sizeof_priv == 0)
is allocated from the size-2048 cache and thus we have ~1000
wasted bytes.
I know, that this is not that much, all the more so on most of
the setups the lo device is single :) but with the net-namespaced
kernel each namespace has its own loopback device, so this problem
becomes more relevant.
I also guess, that the net_device struct allows many ways to get
shrunk, but I noticed, that is has ~20 pointers on functions for
different purposes, like init, hard_start_xmit, neigh_setup, etc.
The proposal is to _move_ all these callbacks on a new structure
called net_device_ops and put a pointer on it on the net_device.
I've checked how much will the net_device weigh after this and
it turned out, that this difference (80 bytes) is enough to get
the 1024-sized net_device and thus a halved loopback.
To make this change smooth, I propose the following plan (however,
three patches I sent will demonstrate the idea better).
* First - declare an empty nd_default_ops and make all new devices
point on this new ops temporarily.
* Then replace each call to dev->xxx() with the dev->nd_ops->xxx()
one step by step. The ns_ops->xxx() will be the nd_default_ops->xxx
then and they all will (temporarily) look like
static void nd_default_xxx(struct net_device *dev, ...)
{
if (dev->xxx)
dev->xxx(dev, ...)
}
* After this patch switch all the drivers (lots of work :( but it can
be done driver-by-driver, i.e. without HUGE patches) from on-device
ops to nd_ops pointer.
* Finally - remove all the ops from the net_device and the default
stubs described above.
Does this idea worth being developed further?
Thanks,
Pavel
--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
| Karl Meyer | PROBLEM: 2.6.23-rc "NETDEV WATCHDOG: eth0: transmit timed out" |
| Greg Kroah-Hartman | [PATCH 040/196] kobject: add kobject_add_ng function |
| Steven Rostedt | [RFC PATCH v4] Unified trace buffer |
| Dave Airlie | [git pull] drm patches for 2.6.27 final |
| Krzysztof Halasa | Re: [PATCH v2] Re: WAN: new PPP code for generic HDLC |
| David Miller | Re: [PATCH] Expose netdevice dev_id through sysfs |
| Jay Cliburn | Re: atl1 64-bit => 32-bit DMA borkage (reproducible, bisected) |
| Evgeniy Polyakov | [resend take 2 0/4] Distributed storage. |
git: | |
| Andrew Morton | Untracked working tree files |
| Miklos Vajna | [rfc] git submodules howto |
| Ben Collins | Re: [kernel.org users] [RFD] On deprecating "git-foo" for builtins |
| Jon Smirl | ! [rejected] master -> master (non-fast forward) |
| rancor | How to copy/pipe console buffert to file? |
| Pieter Verberne | File collision while using pkg_add |
| Greg Thomas | Re: Is it possible to fix a stale NFS hadle without rebooting? |
| Didier Wiroth | win32-codecs, avi and amd64 question |
| Netfilter kernel module | 9 hours ago | Linux kernel |
| serial driver xmit problem | 12 hours ago | Linux kernel |
| Why Windows is better than Linux | 12 hours ago | Linux general |
| How can I see my kernel messages in vt12? | 19 hours ago | Linux kernel |
| Grub | 1 day ago | Linux general |
| vmalloc_fault handling in x86_64 | 1 day ago | Linux kernel |
| epoll_wait()ing on epoll FD | 1 day ago | Linux kernel |
| Framebuffer in x86_64 causes problems to multiseat | 1 day ago | Linux kernel |
| Difference between 2.4 and 2.6 regarding thread creation | 1 day ago | Linux general |
| Compiling gfs2 on kernel 2.6.27 | 2 days ago | Linux kernel |
