net: optimize INET input path further
Followup of commit b178bb3d (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>
Showing
- include/net/inet_sock.h 3 additions, 2 deletionsinclude/net/inet_sock.h
- include/net/inet_timewait_sock.h 7 additions, 13 deletionsinclude/net/inet_timewait_sock.h
- include/net/sock.h 24 additions, 13 deletionsinclude/net/sock.h
- net/core/sock.c 6 additions, 5 deletionsnet/core/sock.c
- net/ipv4/inet_connection_sock.c 3 additions, 4 deletionsnet/ipv4/inet_connection_sock.c
- net/ipv6/udp.c 2 additions, 2 deletionsnet/ipv6/udp.c
Loading
Please register or sign in to comment