linux-hardened/net/8021q
Pavel Emelyanov 67727184f2 [VLAN]: Reduce memory consumed by vlan_groups
Currently each vlan_groupd contains 8 pointers on arrays with 512
pointers on struct net_device each  :)  Such a construction "in many
cases ... wastes memory".

My proposal is to allow for some of these arrays pointers be NULL,
meaning that there are no devices in it. When a new device is added
to the vlan_group, the appropriate array is allocated.

The check in vlan_group_get_device's is safe, since the pointer
vg->vlan_devices_arrays[x] can only switch from NULL to not-NULL.
The vlan_group_prealloc_vid() is guarded with rtnl lock and is
also safe.

I've checked (I hope that) all the places, that use these arrays
and found, that the register_vlan_dev is the only place, that can
put a vlan device on an empty vlan_group.

Rough calculations shows, that after the patch a setup with a
single vlan dev (or up to 512 vlans with sequential vids) will
occupy approximately 8 times less memory.

The question I have is - does this patch makes sense, or a totally
new structures are required to store the vlan_devs?

Signed-off-by: Pavel Emelyanov <xemul@openvz.org>
Signed-off-by: Patrick McHardy <kaber@trash.net>
2008-03-26 16:27:22 -07:00
..
Kconfig [NET]: move config options out to individual protocols 2005-07-11 21:13:56 -07:00
Makefile [VLAN]: Use rtnl_link API 2007-07-10 22:15:03 -07:00
vlan.c [VLAN]: Reduce memory consumed by vlan_groups 2008-03-26 16:27:22 -07:00
vlan.h [VLAN]: checkpatch cleanups 2008-01-28 15:08:33 -08:00
vlan_dev.c [NET] NETNS: Omit net_device->nd_net without CONFIG_NET_NS. 2008-03-26 04:39:53 +09:00
vlan_netlink.c [VLAN]: Turn VLAN_DEV_INFO into inline function 2008-01-28 15:08:32 -08:00
vlanproc.c net: replace remaining __FUNCTION__ occurrences 2008-03-05 20:47:47 -08:00
vlanproc.h [VLAN]: checkpatch cleanups 2008-01-28 15:08:33 -08:00