aboutsummaryrefslogtreecommitdiffstats
path: root/include/net/inet_timewait_sock.h
diff options
context:
space:
mode:
authorEric Dumazet <edumazet@google.com>2013-10-03 03:22:02 -0400
committerDavid S. Miller <davem@davemloft.net>2013-10-08 23:19:24 -0400
commit05dbc7b59481ca891bbcfe6799a562d48159fbf7 (patch)
treef398ddbc5d2a72b3c3b7b16aed8a34b153491341 /include/net/inet_timewait_sock.h
parent53af53ae83fe960ceb9ef74cac7915e9088f4266 (diff)
tcp/dccp: remove twchain
TCP listener refactoring, part 3 : Our goal is to hash SYN_RECV sockets into main ehash for fast lookup, and parallel SYN processing. Current inet_ehash_bucket contains two chains, one for ESTABLISH (and friend states) sockets, another for TIME_WAIT sockets only. As the hash table is sized to get at most one socket per bucket, it makes little sense to have separate twchain, as it makes the lookup slightly more complicated, and doubles hash table memory usage. If we make sure all socket types have the lookup keys at the same offsets, we can use a generic and faster lookup. It turns out TIME_WAIT and ESTABLISHED sockets already have common lookup fields for IPv4. [ INET_TW_MATCH() is no longer needed ] I'll provide a follow-up to factorize IPv6 lookup as well, to remove INET6_TW_MATCH() This way, SYN_RECV pseudo sockets will be supported the same. A new sock_gen_put() helper is added, doing either a sock_put() or inet_twsk_put() [ and will support SYN_RECV later ]. Note this helper should only be called in real slow path, when rcu lookup found a socket that was moved to another identity (freed/reused immediately), but could eventually be used in other contexts, like sock_edemux() Before patch : dmesg | grep "TCP established" TCP established hash table entries: 524288 (order: 11, 8388608 bytes) After patch : TCP established hash table entries: 524288 (order: 10, 4194304 bytes) Signed-off-by: Eric Dumazet <edumazet@google.com> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'include/net/inet_timewait_sock.h')
-rw-r--r--include/net/inet_timewait_sock.h13
1 files changed, 1 insertions, 12 deletions
diff --git a/include/net/inet_timewait_sock.h b/include/net/inet_timewait_sock.h
index f528d1b0ac95..de9e3ab7d43d 100644
--- a/include/net/inet_timewait_sock.h
+++ b/include/net/inet_timewait_sock.h
@@ -141,18 +141,6 @@ struct inet_timewait_sock {
141}; 141};
142#define tw_tclass tw_tos 142#define tw_tclass tw_tos
143 143
144static inline void inet_twsk_add_node_rcu(struct inet_timewait_sock *tw,
145 struct hlist_nulls_head *list)
146{
147 hlist_nulls_add_head_rcu(&tw->tw_node, list);
148}
149
150static inline void inet_twsk_add_bind_node(struct inet_timewait_sock *tw,
151 struct hlist_head *list)
152{
153 hlist_add_head(&tw->tw_bind_node, list);
154}
155
156static inline int inet_twsk_dead_hashed(const struct inet_timewait_sock *tw) 144static inline int inet_twsk_dead_hashed(const struct inet_timewait_sock *tw)
157{ 145{
158 return !hlist_unhashed(&tw->tw_death_node); 146 return !hlist_unhashed(&tw->tw_death_node);
@@ -192,6 +180,7 @@ static inline struct inet_timewait_sock *inet_twsk(const struct sock *sk)
192 return (struct inet_timewait_sock *)sk; 180 return (struct inet_timewait_sock *)sk;
193} 181}
194 182
183void inet_twsk_free(struct inet_timewait_sock *tw);
195void inet_twsk_put(struct inet_timewait_sock *tw); 184void inet_twsk_put(struct inet_timewait_sock *tw);
196 185
197int inet_twsk_unhash(struct inet_timewait_sock *tw); 186int inet_twsk_unhash(struct inet_timewait_sock *tw);