aboutsummaryrefslogtreecommitdiffstats
path: root/net/core/sock.c
diff options
context:
space:
mode:
authorEric Dumazet <dada1@cosmosbay.com>2007-03-04 19:05:44 -0500
committerDavid S. Miller <davem@sunset.davemloft.net>2007-04-26 01:23:27 -0400
commitfa438ccfdfd3f6db02c13b61b21454eb81cd6a13 (patch)
treea1759259d7543586185e2fb9db21461147944f18 /net/core/sock.c
parente317f6f69cb95527799d308a9421b7dc1252989a (diff)
[NET]: Keep sk_backlog near sk_lock
sk_backlog is a critical field of struct sock. (known famous words) It is (ab)used in hot paths, in particular in release_sock(), tcp_recvmsg(), tcp_v4_rcv(), sk_receive_skb(). It really makes sense to place it next to sk_lock, because sk_backlog is only used after sk_lock locked (and thus memory cache line in L1 cache). This should reduce cache misses and sk_lock acquisition time. (In theory, we could only move the head pointer near sk_lock, and leaving tail far away, because 'tail' is normally not so hot, but keep it simple :) ) Signed-off-by: Eric Dumazet <dada1@cosmosbay.com> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'net/core/sock.c')
-rw-r--r--net/core/sock.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/net/core/sock.c b/net/core/sock.c
index 27c4f62382bd..6d35d5775ba8 100644
--- a/net/core/sock.c
+++ b/net/core/sock.c
@@ -904,6 +904,7 @@ struct sock *sk_clone(const struct sock *sk, const gfp_t priority)
904 sk_node_init(&newsk->sk_node); 904 sk_node_init(&newsk->sk_node);
905 sock_lock_init(newsk); 905 sock_lock_init(newsk);
906 bh_lock_sock(newsk); 906 bh_lock_sock(newsk);
907 newsk->sk_backlog.head = newsk->sk_backlog.tail = NULL;
907 908
908 atomic_set(&newsk->sk_rmem_alloc, 0); 909 atomic_set(&newsk->sk_rmem_alloc, 0);
909 atomic_set(&newsk->sk_wmem_alloc, 0); 910 atomic_set(&newsk->sk_wmem_alloc, 0);
@@ -923,7 +924,6 @@ struct sock *sk_clone(const struct sock *sk, const gfp_t priority)
923 newsk->sk_wmem_queued = 0; 924 newsk->sk_wmem_queued = 0;
924 newsk->sk_forward_alloc = 0; 925 newsk->sk_forward_alloc = 0;
925 newsk->sk_send_head = NULL; 926 newsk->sk_send_head = NULL;
926 newsk->sk_backlog.head = newsk->sk_backlog.tail = NULL;
927 newsk->sk_userlocks = sk->sk_userlocks & ~SOCK_BINDPORT_LOCK; 927 newsk->sk_userlocks = sk->sk_userlocks & ~SOCK_BINDPORT_LOCK;
928 928
929 sock_reset_flag(newsk, SOCK_DONE); 929 sock_reset_flag(newsk, SOCK_DONE);