kernel_optimize_test/net
Robert Shearman cf4b24f002 mpls: reduce memory usage of routes
Nexthops for MPLS routes have a via address field sized for the
largest via address that is expected, which is 32 bytes. This means
that in the most common case of having ipv4 via addresses, 28 bytes of
memory more than required are used per nexthop. In the other common
case of an ipv6 nexthop then 16 bytes more than required are
used. With large numbers of MPLS routes this extra memory usage could
start to become significant.

To avoid allocating memory for a maximum length via address when not
all of it is required and to allow for ease of iterating over
nexthops, then the via addresses are changed to be stored in the same
memory block as the route and nexthops, but in an array after the end
of the array of nexthops. New accessors are provided to retrieve a
pointer to the via address.

To allow for O(1) access without having to store a pointer or offset
per nh, the via address for each nexthop is sized according to the
maximum via address for any nexthop in the route, which is stored in a
new route field, rt_max_alen, but this is in an existing hole in
struct mpls_route so it doesn't increase the size of the
structure. Each via address is ensured to be aligned to VIA_ALEN_ALIGN
to account for architectures that don't allow unaligned accesses.

Signed-off-by: Robert Shearman <rshearma@brocade.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
2015-10-27 19:52:59 -07:00
..
6lowpan
9p
802
8021q
appletalk
atm
ax25
batman-adv
bluetooth Bluetooth: Increase minor version of core module 2015-10-22 13:37:26 +03:00
bridge netlink: Rightsize IFLA_AF_SPEC size calculation 2015-10-21 19:15:20 -07:00
caif
can
ceph
core sock: don't enable netstamp for af_unix sockets 2015-10-27 19:39:14 -07:00
dcb
dccp tcp/dccp: fix hashdance race for passive sessions 2015-10-23 05:42:21 -07:00
decnet
dns_resolver
dsa net: dsa: remove port_fdb_getnext 2015-10-22 07:38:45 -07:00
ethernet
hsr
ieee802154 ieee802154: 6lowpan: fix memory leak 2015-10-22 12:24:42 +02:00
ipv4 Merge git://git.kernel.org/pub/scm/linux/kernel/git/davem/net 2015-10-24 06:54:12 -07:00
ipv6 ipv6: icmp: include addresses in debug messages 2015-10-26 21:59:42 -07:00
ipx
irda irda: precedence bug in irlmp_seq_hb_idx() 2015-10-21 07:48:26 -07:00
iucv
key af_key: fix two typos 2015-10-23 03:05:19 -07:00
l2tp
l3mdev
lapb
llc
mac80211 Here's another set of patches for the current cycle: 2015-10-22 07:28:41 -07:00
mac802154
mpls mpls: reduce memory usage of routes 2015-10-27 19:52:59 -07:00
netfilter Merge git://git.kernel.org/pub/scm/linux/kernel/git/davem/net 2015-10-24 06:54:12 -07:00
netlabel
netlink Merge git://git.kernel.org/pub/scm/linux/kernel/git/davem/net 2015-10-24 06:54:12 -07:00
netrom
nfc
openvswitch Merge git://git.kernel.org/pub/scm/linux/kernel/git/davem/net 2015-10-24 06:54:12 -07:00
packet
phonet
rds
rfkill
rose
rxrpc
sched
sctp
sunrpc
switchdev
tipc tipc: link_is_bc_sndlink() can be static 2015-10-25 06:31:52 -07:00
unix af_unix: do not report POLLOUT on listeners 2015-10-25 06:37:45 -07:00
vmw_vsock VSOCK: Fix lockdep issue. 2015-10-22 18:26:29 -07:00
wimax
wireless
x25
xfrm Merge git://git.kernel.org/pub/scm/linux/kernel/git/davem/net 2015-10-24 06:54:12 -07:00
compat.c
Kconfig
Makefile
socket.c
sysctl_net.c net: sysctl: fix a kmemleak warning 2015-10-23 06:22:08 -07:00