aboutsummaryrefslogtreecommitdiffstats
path: root/include/net/inet_hashtables.h
diff options
context:
space:
mode:
authorPavel Emelyanov <xemul@openvz.org>2007-12-20 18:31:33 -0500
committerDavid S. Miller <davem@davemloft.net>2008-01-28 17:59:26 -0500
commit152da81deb9a4870aeac352336184b2b14d4b2ba (patch)
tree63db8e49be92e7f23667d8c3356177840287118f /include/net/inet_hashtables.h
parentd6701191329b51793bc56724548f0863d2149c29 (diff)
[INET]: Uninline the __inet_hash function.
This one is used in quite many places in the networking code and seems to big to be inline. After the patch net/ipv4/build-in.o loses ~650 bytes: add/remove: 2/0 grow/shrink: 0/5 up/down: 461/-1114 (-653) function old new delta __inet_hash_nolisten - 282 +282 __inet_hash - 179 +179 tcp_sacktag_write_queue 2255 2254 -1 __inet_lookup_listener 284 274 -10 tcp_v4_syn_recv_sock 755 493 -262 tcp_v4_hash 389 35 -354 inet_hash_connect 1086 599 -487 This version addresses the issue pointed by Eric, that while being inline this function was optimized by gcc in respect to the 'listen_possible' argument. Signed-off-by: Pavel Emelyanov <xemul@openvz.org> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'include/net/inet_hashtables.h')
-rw-r--r--include/net/inet_hashtables.h29
1 files changed, 3 insertions, 26 deletions
diff --git a/include/net/inet_hashtables.h b/include/net/inet_hashtables.h
index 37f6cb112127..982d487751f9 100644
--- a/include/net/inet_hashtables.h
+++ b/include/net/inet_hashtables.h
@@ -264,37 +264,14 @@ static inline void inet_listen_unlock(struct inet_hashinfo *hashinfo)
264 wake_up(&hashinfo->lhash_wait); 264 wake_up(&hashinfo->lhash_wait);
265} 265}
266 266
267static inline void __inet_hash(struct inet_hashinfo *hashinfo, 267extern void __inet_hash(struct inet_hashinfo *hashinfo, struct sock *sk);
268 struct sock *sk, const int listen_possible) 268extern void __inet_hash_nolisten(struct inet_hashinfo *hinfo, struct sock *sk);
269{
270 struct hlist_head *list;
271 rwlock_t *lock;
272
273 BUG_TRAP(sk_unhashed(sk));
274 if (listen_possible && sk->sk_state == TCP_LISTEN) {
275 list = &hashinfo->listening_hash[inet_sk_listen_hashfn(sk)];
276 lock = &hashinfo->lhash_lock;
277 inet_listen_wlock(hashinfo);
278 } else {
279 struct inet_ehash_bucket *head;
280 sk->sk_hash = inet_sk_ehashfn(sk);
281 head = inet_ehash_bucket(hashinfo, sk->sk_hash);
282 list = &head->chain;
283 lock = inet_ehash_lockp(hashinfo, sk->sk_hash);
284 write_lock(lock);
285 }
286 __sk_add_node(sk, list);
287 sock_prot_inc_use(sk->sk_prot);
288 write_unlock(lock);
289 if (listen_possible && sk->sk_state == TCP_LISTEN)
290 wake_up(&hashinfo->lhash_wait);
291}
292 269
293static inline void inet_hash(struct inet_hashinfo *hashinfo, struct sock *sk) 270static inline void inet_hash(struct inet_hashinfo *hashinfo, struct sock *sk)
294{ 271{
295 if (sk->sk_state != TCP_CLOSE) { 272 if (sk->sk_state != TCP_CLOSE) {
296 local_bh_disable(); 273 local_bh_disable();
297 __inet_hash(hashinfo, sk, 1); 274 __inet_hash(hashinfo, sk);
298 local_bh_enable(); 275 local_bh_enable();
299 } 276 }
300} 277}