linux-hardened/net/ipv6
Eric Dumazet dbca9b2750 [NET]: change layout of ehash table
ehash table layout is currently this one :

First half of this table is used by sockets not in TIME_WAIT state
Second half of it is used by sockets in TIME_WAIT state.

This is non optimal because of for a given hash or socket, the two chain heads 
are located in separate cache lines.
Moreover the locks of the second half are never used.

If instead of this halving, we use two list heads in inet_ehash_bucket instead 
of only one, we probably can avoid one cache miss, and reduce ram usage, 
particularly if sizeof(rwlock_t) is big (various CONFIG_DEBUG_SPINLOCK, 
CONFIG_DEBUG_LOCK_ALLOC settings). So we still halves the table but we keep 
together related chains to speedup lookups and socket state change.

In this patch I did not try to align struct inet_ehash_bucket, but a future 
patch could try to make this structure have a convenient size (a power of two 
or a multiple of L1_CACHE_SIZE).
I guess rwlock will just vanish as soon as RCU is plugged into ehash :) , so 
maybe we dont need to scratch our heads to align the bucket...

Note : In case struct inet_ehash_bucket is not a power of two, we could 
probably change alloc_large_system_hash() (in case it use __get_free_pages()) 
to free the unused space. It currently allocates a big zone, but the last 
quarter of it could be freed. Again, this should be a temporary 'problem'.

Patch tested on ipv4 tcp only, but should be OK for IPV6 and DCCP.

Signed-off-by: Eric Dumazet <dada1@cosmosbay.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
2007-02-08 14:16:46 -08:00
..
netfilter [NETFILTER]: ip6_tables: remove redundant structure definitions 2007-02-08 12:39:23 -08:00
addrconf.c [NETLINK]: Don't BUG on undersized allocations 2007-02-08 12:38:41 -08:00
af_inet6.c [INET]: style updates for the inet_sock->is_icsk assignment fix 2007-01-09 14:37:06 -08:00
ah6.c [IPV6]: Use kmemdup 2006-12-02 21:23:58 -08:00
anycast.c [IPV6] ADDRCONF: Convert addrconf_lock to RCU. 2006-09-22 15:20:26 -07:00
datagram.c [IPV4/IPV6]: Always wait for IPSEC SA resolution in socket contexts. 2007-02-08 12:38:45 -08:00
esp6.c [IPV6]: 'info' argument of ipv6 ->err_handler() is net-endian 2006-12-02 21:21:12 -08:00
exthdrs.c [IPV6]: Misc endianness annotations. 2006-12-02 21:22:52 -08:00
exthdrs_core.c [IPV6]: Misc endianness annotations. 2006-12-02 21:22:52 -08:00
fib6_rules.c [IPv6] rules: Remove bogus tos validation check 2006-12-02 21:22:12 -08:00
icmp.c [NET]: Annotate callers of the reset of checksum.h stuff. 2006-12-02 21:23:34 -08:00
inet6_connection_sock.c [TCP]: Restore SKB socket owner setting in tcp_transmit_skb(). 2007-01-26 01:04:55 -08:00
inet6_hashtables.c [NET]: change layout of ehash table 2007-02-08 14:16:46 -08:00
ip6_fib.c [PATCH] slab: remove kmem_cache_t 2006-12-07 08:39:25 -08:00
ip6_flowlabel.c [IPV6]: flowlabels are net-endian 2006-12-02 21:21:21 -08:00
ip6_input.c [IPV6]: Per-interface statistics support. 2006-12-02 21:22:08 -08:00
ip6_output.c [NET]: Convert hh_lock to seqlock. 2006-12-08 17:19:20 -08:00
ip6_tunnel.c [NET]: unregister_netdevice as void 2007-02-08 12:39:06 -08:00
ipcomp6.c [IPV6]: 'info' argument of ipv6 ->err_handler() is net-endian 2006-12-02 21:21:12 -08:00
ipv6_sockglue.c [IPV6]: Fix IPV6_UNICAST_HOPS getsockopt(). 2006-12-13 16:48:25 -08:00
ipv6_syms.c [IPV6] ADDRCONF: Convert addrconf_lock to RCU. 2006-09-22 15:20:26 -07:00
Kconfig [NET]: Rethink mark field in struct flowi 2006-12-02 21:21:39 -08:00
Makefile [NET]: Supporting UDP-Lite (RFC 3828) in Linux 2006-12-02 21:22:46 -08:00
mcast.c [IPV4/IPV6] multicast: Check add_grhead() return value 2007-02-08 12:39:04 -08:00
mip6.c [IPV6] RAW: Add checksum default defines for MH. 2007-02-08 12:39:05 -08:00
ndisc.c [IPV6]: fix BUG of ndisc_send_redirect() 2007-01-30 14:33:20 -08:00
netfilter.c [NET]: Annotate __skb_checksum_complete() and friends. 2006-12-02 21:23:38 -08:00
proc.c [NET]: Supporting UDP-Lite (RFC 3828) in Linux 2006-12-02 21:22:46 -08:00
protocol.c Linux-2.6.12-rc2 2005-04-16 15:20:36 -07:00
raw.c [IPV6] RAW: Add checksum default defines for MH. 2007-02-08 12:39:05 -08:00
reassembly.c [IPV6]: Misc endianness annotations. 2006-12-02 21:22:52 -08:00
route.c [IPV6] ROUTE: Do not route packets to link-local address on other device. 2007-02-08 12:38:42 -08:00
sit.c [NET]: unregister_netdevice as void 2007-02-08 12:39:06 -08:00
sysctl_net_ipv6.c Remove obsolete #include <linux/config.h> 2006-06-30 19:25:36 +02:00
tcp_ipv6.c [IPV4/IPV6]: Always wait for IPSEC SA resolution in socket contexts. 2007-02-08 12:38:45 -08:00
tunnel6.c [IPV6]: 'info' argument of ipv6 ->err_handler() is net-endian 2006-12-02 21:21:12 -08:00
udp.c [IPV4/IPV6]: Always wait for IPSEC SA resolution in socket contexts. 2007-02-08 12:38:45 -08:00
udp_impl.h [NET]: Supporting UDP-Lite (RFC 3828) in Linux 2006-12-02 21:22:46 -08:00
udplite.c [NET]: Possible cleanups. 2006-12-02 21:31:51 -08:00
xfrm6_input.c [XFRM]: xrfm_replay_check() annotations 2006-09-28 18:02:40 -07:00
xfrm6_mode_beet.c [XFRM]: BEET mode 2006-10-04 00:31:09 -07:00
xfrm6_mode_ro.c [IPSEC]: output mode to take an xfrm state as input param 2006-09-22 15:18:48 -07:00
xfrm6_mode_transport.c [IPSEC]: output mode to take an xfrm state as input param 2006-09-22 15:18:48 -07:00
xfrm6_mode_tunnel.c [IPSEC]: IPv4 over IPv6 IPsec tunnel 2007-02-08 12:39:02 -08:00
xfrm6_output.c [IPSEC]: output mode to take an xfrm state as input param 2006-09-22 15:18:48 -07:00
xfrm6_policy.c [IPSEC]: IPv6 over IPv4 IPsec tunnel 2007-02-08 12:39:01 -08:00
xfrm6_state.c [IPSEC]: exporting xfrm_state_afinfo 2007-02-08 12:39:00 -08:00
xfrm6_tunnel.c [PATCH] slab: remove kmem_cache_t 2006-12-07 08:39:25 -08:00