linux/net/ipv4
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
..
ipvs
netfilter [NETFILTER]: {ip,ip6}_tables: use struct xt_table instead of redefined structure names 2007-02-08 12:39:20 -08:00
af_inet.c [IPV4/IPV6]: Always wait for IPSEC SA resolution in socket contexts. 2007-02-08 12:38:45 -08:00
ah4.c
arp.c
cipso_ipv4.c
datagram.c [IPV4/IPV6]: Always wait for IPSEC SA resolution in socket contexts. 2007-02-08 12:38:45 -08:00
devinet.c [NETLINK]: Don't BUG on undersized allocations 2007-02-08 12:38:41 -08:00
esp4.c
fib_frontend.c
fib_hash.c
fib_lookup.h
fib_rules.c
fib_semantics.c [NETLINK]: Don't BUG on undersized allocations 2007-02-08 12:38:41 -08:00
fib_trie.c [IPV4]: Fix single-entry /proc/net/fib_trie output. 2007-01-26 19:06:01 -08:00
icmp.c
igmp.c [IPV4/IPV6] multicast: Check add_grhead() return value 2007-02-08 12:39:04 -08:00
inet_connection_sock.c
inet_diag.c [NET]: change layout of ehash table 2007-02-08 14:16:46 -08:00
inet_hashtables.c [NET]: change layout of ehash table 2007-02-08 14:16:46 -08:00
inet_timewait_sock.c [NET]: change layout of ehash table 2007-02-08 14:16:46 -08:00
inetpeer.c
ip_forward.c
ip_fragment.c
ip_gre.c [NET]: unregister_netdevice as void 2007-02-08 12:39:06 -08:00
ip_input.c
ip_options.c
ip_output.c [TCP]: Restore SKB socket owner setting in tcp_transmit_skb(). 2007-01-26 01:04:55 -08:00
ip_sockglue.c
ipcomp.c
ipconfig.c
ipip.c [NET]: unregister_netdevice as void 2007-02-08 12:39:06 -08:00
ipmr.c
Kconfig
Makefile
multipath_drr.c
multipath_random.c
multipath_rr.c
multipath_wrandom.c
multipath.c
netfilter.c [NETFILTER]: Fix routing of REJECT target generated packets in output chain 2007-01-04 12:15:34 -08:00
proc.c
protocol.c
raw.c [IPV4/IPV6]: Always wait for IPSEC SA resolution in socket contexts. 2007-02-08 12:38:45 -08:00
route.c [NETLINK]: Don't BUG on undersized allocations 2007-02-08 12:38:41 -08:00
syncookies.c [IPV6]: Assorted trivial endianness annotations. 2006-12-02 21:22:50 -08:00
sysctl_net_ipv4.c
tcp_bic.c
tcp_cong.c
tcp_cubic.c
tcp_diag.c
tcp_highspeed.c
tcp_htcp.c
tcp_hybla.c
tcp_input.c [TCP]: Check num sacks in SACK fast path 2007-02-08 12:38:50 -08:00
tcp_ipv4.c [NET]: change layout of ehash table 2007-02-08 14:16:46 -08:00
tcp_lp.c
tcp_minisocks.c
tcp_output.c [TCP]: Don't apply FIN exception to full TSO segments. 2007-02-08 12:38:51 -08:00
tcp_probe.c [PATCH] email change for shemminger@osdl.org 2007-01-23 14:18:49 -08:00
tcp_scalable.c
tcp_timer.c
tcp_vegas.c
tcp_veno.c
tcp_westwood.c
tcp.c [NET]: change layout of ehash table 2007-02-08 14:16:46 -08:00
tunnel4.c
udp_impl.h
udp.c [IPV4/IPV6]: Always wait for IPSEC SA resolution in socket contexts. 2007-02-08 12:38:45 -08:00
udplite.c
xfrm4_input.c
xfrm4_mode_beet.c
xfrm4_mode_transport.c
xfrm4_mode_tunnel.c [IPSEC]: IPv6 over IPv4 IPsec tunnel 2007-02-08 12:39:01 -08:00
xfrm4_output.c
xfrm4_policy.c [XFRM]: Fix missed error setting in xfrm4_policy.c 2007-02-08 12:39:03 -08:00
xfrm4_state.c [IPSEC]: exporting xfrm_state_afinfo 2007-02-08 12:39:00 -08:00
xfrm4_tunnel.c