linux/net/dccp
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
..
ccids [DCCP]: Warning fixes. 2007-02-08 12:38:56 -08:00
Kconfig [DCCP]: enable debug messages also for static builds 2006-12-02 21:24:35 -08:00
Makefile [DCCPv6]: Resolve conditional build problem 2006-12-02 21:22:28 -08:00
ackvec.c [DCCP]: Whitespace cleanups 2006-12-11 14:35:00 -08:00
ackvec.h [DCCP] ackvec: infrastructure for sending more than one ackvec per packet 2006-12-02 21:30:32 -08:00
ccid.c [PATCH] slab: remove kmem_cache_t 2006-12-07 08:39:25 -08:00
ccid.h [DCCP] ccid: Deprecate ccid_hc_tx_insert_options 2006-12-11 14:34:49 -08:00
dccp.h [DCCP]: Debug timeval operations 2006-12-11 14:34:45 -08:00
diag.c
feat.c [DCCP]: Whitespace cleanups 2006-12-11 14:35:00 -08:00
feat.h [DCCP]: Make feature negotiation more readable 2006-12-02 21:22:29 -08:00
input.c [DCCP]: Whitespace cleanups 2006-12-11 14:35:00 -08:00
ipv4.c [IPV4/IPV6]: Always wait for IPSEC SA resolution in socket contexts. 2007-02-08 12:38:45 -08:00
ipv6.c [IPV4/IPV6]: Always wait for IPSEC SA resolution in socket contexts. 2007-02-08 12:38:45 -08:00
ipv6.h
minisocks.c [DCCP]: Whitespace cleanups 2006-12-11 14:35:00 -08:00
options.c [DCCP] ccid: Deprecate ccid_hc_tx_insert_options 2006-12-11 14:34:49 -08:00
output.c [TCP]: Restore SKB socket owner setting in tcp_transmit_skb(). 2007-01-26 01:04:55 -08:00
probe.c [DCCP]: Make dccp_probe more portable 2006-12-02 21:24:39 -08:00
proto.c [NET]: change layout of ehash table 2007-02-08 14:16:46 -08:00
sysctl.c [DCCP]: Remove allocation of sysctl numbers 2006-12-02 21:30:56 -08:00
timer.c [DCCP]: Whitespace cleanups 2006-12-11 14:35:00 -08:00