Skip to content

Commit 43f51df

Browse files
edumazetdavem330
authored andcommitted
net: move early demux fields close to sk_refcnt
sk_rx_dst/sk_rx_dst_ifindex/sk_rx_dst_cookie are read in early demux, and currently spans two cache lines. Moving them close to sk_refcnt makes more sense, as only one cache line is needed. New layout for this hot cache line is : struct sock { struct sock_common __sk_common; /* 0 0x88 */ /* --- cacheline 2 boundary (128 bytes) was 8 bytes ago --- */ struct dst_entry * sk_rx_dst; /* 0x88 0x8 */ int sk_rx_dst_ifindex; /* 0x90 0x4 */ u32 sk_rx_dst_cookie; /* 0x94 0x4 */ socket_lock_t sk_lock; /* 0x98 0x20 */ atomic_t sk_drops; /* 0xb8 0x4 */ int sk_rcvlowat; /* 0xbc 0x4 */ /* --- cacheline 3 boundary (192 bytes) --- */ Signed-off-by: Eric Dumazet <edumazet@google.com> Signed-off-by: David S. Miller <davem@davemloft.net>
1 parent 29fbc26 commit 43f51df

File tree

1 file changed

+5
-3
lines changed

1 file changed

+5
-3
lines changed

include/net/sock.h

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -390,6 +390,11 @@ struct sock {
390390
#define sk_flags __sk_common.skc_flags
391391
#define sk_rxhash __sk_common.skc_rxhash
392392

393+
/* early demux fields */
394+
struct dst_entry *sk_rx_dst;
395+
int sk_rx_dst_ifindex;
396+
u32 sk_rx_dst_cookie;
397+
393398
socket_lock_t sk_lock;
394399
atomic_t sk_drops;
395400
int sk_rcvlowat;
@@ -432,9 +437,6 @@ struct sock {
432437
#ifdef CONFIG_XFRM
433438
struct xfrm_policy __rcu *sk_policy[2];
434439
#endif
435-
struct dst_entry *sk_rx_dst;
436-
int sk_rx_dst_ifindex;
437-
u32 sk_rx_dst_cookie;
438440

439441
struct dst_entry __rcu *sk_dst_cache;
440442
atomic_t sk_omem_alloc;

0 commit comments

Comments
 (0)