diff options
author | Eric Dumazet <eric.dumazet@gmail.com> | 2010-11-30 19:04:07 +0000 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2010-12-09 20:05:58 -0800 |
commit | 68835aba4d9b74e2f94106d13b6a4bddc447c4c8 (patch) | |
tree | 468a9465acfa027791facef13fb6ef5129dda257 /include/net/inet_sock.h | |
parent | defb3519a64141608725e2dac5a5aa9a3c644bae (diff) | |
download | op-kernel-dev-68835aba4d9b74e2f94106d13b6a4bddc447c4c8.zip op-kernel-dev-68835aba4d9b74e2f94106d13b6a4bddc447c4c8.tar.gz |
net: optimize INET input path further
Followup of commit b178bb3dfc30 (net: reorder struct sock fields)
Optimize INET input path a bit further, by :
1) moving sk_refcnt close to sk_lock.
This reduces number of dirtied cache lines by one on 64bit arches (and
64 bytes cache line size).
2) moving inet_daddr & inet_rcv_saddr at the beginning of sk
(same cache line than hash / family / bound_dev_if / nulls_node)
This reduces number of accessed cache lines in lookups by one, and dont
increase size of inet and timewait socks.
inet and tw sockets now share same place-holder for these fields.
Before patch :
offsetof(struct sock, sk_refcnt) = 0x10
offsetof(struct sock, sk_lock) = 0x40
offsetof(struct sock, sk_receive_queue) = 0x60
offsetof(struct inet_sock, inet_daddr) = 0x270
offsetof(struct inet_sock, inet_rcv_saddr) = 0x274
After patch :
offsetof(struct sock, sk_refcnt) = 0x44
offsetof(struct sock, sk_lock) = 0x48
offsetof(struct sock, sk_receive_queue) = 0x68
offsetof(struct inet_sock, inet_daddr) = 0x0
offsetof(struct inet_sock, inet_rcv_saddr) = 0x4
compute_score() (udp or tcp) now use a single cache line per ignored
item, instead of two.
Signed-off-by: Eric Dumazet <eric.dumazet@gmail.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'include/net/inet_sock.h')
-rw-r--r-- | include/net/inet_sock.h | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/include/net/inet_sock.h b/include/net/inet_sock.h index 8945f9f..8181498 100644 --- a/include/net/inet_sock.h +++ b/include/net/inet_sock.h @@ -116,8 +116,9 @@ struct inet_sock { struct ipv6_pinfo *pinet6; #endif /* Socket demultiplex comparisons on incoming packets. */ - __be32 inet_daddr; - __be32 inet_rcv_saddr; +#define inet_daddr sk.__sk_common.skc_daddr +#define inet_rcv_saddr sk.__sk_common.skc_rcv_saddr + __be16 inet_dport; __u16 inet_num; __be32 inet_saddr; |