linux-hardened/net
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
..
802 [NET]: Kill direct includes of asm/checksum.h 2006-12-02 21:22:59 -08:00
8021q [PATCH] Finish annotations of struct vlan_ethhdr 2006-10-10 16:15:34 -07:00
appletalk [PATCH] severing skbuff.h -> highmem.h 2006-12-04 02:00:29 -05:00
atm [ATM]: Fix for crash in adummy_init() 2007-02-08 12:38:53 -08:00
ax25 [AX.25]: Fix unchecked ax25_linkfail_register uses 2006-12-17 21:59:11 -08:00
bluetooth [Bluetooth] Restrict well known PSM to privileged users 2007-01-22 22:00:45 +01:00
bridge [NET]: Add UDPLITE support in a few missing spots 2007-02-08 12:39:14 -08:00
core [NET]: unregister_netdevice as void 2007-02-08 12:39:06 -08:00
dccp [NET]: change layout of ehash table 2007-02-08 14:16:46 -08:00
decnet [NETLINK]: Don't BUG on undersized allocations 2007-02-08 12:38:41 -08:00
econet [NET]: Conversions from kmalloc+memset to k(z|c)alloc. 2006-07-21 14:51:30 -07:00
ethernet [NET]: Kill direct includes of asm/checksum.h 2006-12-02 21:22:59 -08:00
ieee80211 [PATCH] softmac: avoid assert in ieee80211softmac_wx_get_rate 2007-02-05 16:58:42 -05:00
ipv4 [NET]: change layout of ehash table 2007-02-08 14:16:46 -08:00
ipv6 [NET]: change layout of ehash table 2007-02-08 14:16:46 -08:00
ipx [IPX]: Annotate and fix IPX checksum 2006-11-05 14:11:25 -08:00
irda [IRLAN]: handle out of memory errors 2007-02-08 12:39:08 -08:00
iucv [S390]: Add AF_IUCV socket support 2007-02-08 13:51:54 -08:00
key [PFKEYV2]: Extension for dynamic update of endpoint address(es) 2007-02-08 13:14:33 -08:00
lapb [LAPB]: Fix windowsize check 2006-08-05 21:15:58 -07:00
llc [LLC]: anotations 2006-12-02 21:21:23 -08:00
netfilter [NETFILTER]: add IPv6-capable TCPMSS target 2007-02-08 12:39:16 -08:00
netlabel NetLabel: correct CIPSO tag handling when adding new DOI definitions 2007-01-09 00:30:01 -08:00
netlink [AF_NETLINK]: module_put cleanup 2007-01-03 18:38:15 -08:00
netrom [AX.25]: Fix unchecked ax25_linkfail_register uses 2006-12-17 21:59:11 -08:00
packet [PACKET]: Fix skb->cb clobbering between aux and sockaddr 2007-02-08 12:38:47 -08:00
rose [AX.25]: Fix unchecked rose_add_loopback_neigh uses 2006-12-17 21:59:14 -08:00
rxrpc [PATCH] Add include/linux/freezer.h and move definitions from sched.h 2006-12-07 08:39:27 -08:00
sched [NETFILTER]: {ip,ip6}_tables: use struct xt_table instead of redefined structure names 2007-02-08 12:39:20 -08:00
sctp [SCTP]: Force update of the rto when processing HB-ACK 2007-01-30 14:36:14 -08:00
sunrpc [PATCH] knfsd: ratelimit some nfsd messages that are triggered by external events 2007-01-30 08:26:45 -08:00
tipc [PATCH] getting rid of all casts of k[cmz]alloc() calls 2006-12-13 09:05:58 -08:00
unix [PATCH] struct path: convert unix 2006-12-08 08:28:50 -08:00
wanrouter [NET] net/wanrouter/wanmain.c: cleanups 2007-02-08 12:38:54 -08:00
x25 [X.25]: Adds /proc/net/x25/forward to view active forwarded calls. 2007-02-08 13:35:18 -08:00
xfrm [XFRM]: xfrm_migrate() needs exporting to modules. 2007-02-08 13:29:15 -08:00
compat.c [NET]: File descriptor loss while receiving SCM_RIGHTS 2006-10-11 23:59:48 -07:00
Kconfig [S390]: Rewrite of the IUCV base code, part 2 2007-02-08 13:37:42 -08:00
Makefile [S390]: Rewrite of the IUCV base code, part 2 2007-02-08 13:37:42 -08:00
nonet.c [PATCH] Make most file operations structs in fs/ const 2006-03-28 09:16:06 -08:00
socket.c [PATCH] struct path: convert net 2006-12-08 08:28:48 -08:00
sysctl_net.c Remove obsolete #include <linux/config.h> 2006-06-30 19:25:36 +02:00
TUNABLE