diff options
author | Eric Dumazet <dada1@cosmosbay.com> | 2008-11-16 22:40:17 -0500 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2008-11-16 22:40:17 -0500 |
commit | 3ab5aee7fe840b5b1b35a8d1ac11c3de5281e611 (patch) | |
tree | 468296b7be813643248d4ca67497d6ddb6934fc6 /net/core | |
parent | 88ab1932eac721c6e7336708558fa5ed02c85c80 (diff) |
net: Convert TCP & DCCP hash tables to use RCU / hlist_nulls
RCU was added to UDP lookups, using a fast infrastructure :
- sockets kmem_cache use SLAB_DESTROY_BY_RCU and dont pay the
price of call_rcu() at freeing time.
- hlist_nulls permits to use few memory barriers.
This patch uses same infrastructure for TCP/DCCP established
and timewait sockets.
Thanks to SLAB_DESTROY_BY_RCU, no slowdown for applications
using short lived TCP connections. A followup patch, converting
rwlocks to spinlocks will even speedup this case.
__inet_lookup_established() is pretty fast now we dont have to
dirty a contended cache line (read_lock/read_unlock)
Only established and timewait hashtable are converted to RCU
(bind table and listen table are still using traditional locking)
Signed-off-by: Eric Dumazet <dada1@cosmosbay.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'net/core')
-rw-r--r-- | net/core/sock.c | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/net/core/sock.c b/net/core/sock.c index ded1eb5d2fd4..38de9c3f563b 100644 --- a/net/core/sock.c +++ b/net/core/sock.c | |||
@@ -2082,7 +2082,9 @@ int proto_register(struct proto *prot, int alloc_slab) | |||
2082 | prot->twsk_prot->twsk_slab = | 2082 | prot->twsk_prot->twsk_slab = |
2083 | kmem_cache_create(timewait_sock_slab_name, | 2083 | kmem_cache_create(timewait_sock_slab_name, |
2084 | prot->twsk_prot->twsk_obj_size, | 2084 | prot->twsk_prot->twsk_obj_size, |
2085 | 0, SLAB_HWCACHE_ALIGN, | 2085 | 0, |
2086 | SLAB_HWCACHE_ALIGN | | ||
2087 | prot->slab_flags, | ||
2086 | NULL); | 2088 | NULL); |
2087 | if (prot->twsk_prot->twsk_slab == NULL) | 2089 | if (prot->twsk_prot->twsk_slab == NULL) |
2088 | goto out_free_timewait_sock_slab_name; | 2090 | goto out_free_timewait_sock_slab_name; |