Commit 8bdd663aba341c15cd2fa9dbd7061b8b387964dc
Committed by
David S. Miller
1 parent
ff4fbd43fe
Exists in
master
and in
4 other branches
net: reorder fields of struct socket
On x86_64, its rather unfortunate that "wait_queue_head_t wait" field of "struct socket" spans two cache lines (assuming a 64 bytes cache line in current cpus) offsetof(struct socket, wait)=0x30 sizeof(wait_queue_head_t)=0x18 This might explain why Kenny Chang noticed that his multicast workload was performing bad with 64 bit kernels, since more cache lines ping pongs were involved. This litle patch moves "wait" field next "fasync_list" so that both fields share a single cache line, to speedup sock_def_readable() Signed-off-by: Eric Dumazet <dada1@cosmosbay.com> Signed-off-by: David S. Miller <davem@davemloft.net>
Showing 1 changed file with 6 additions and 2 deletions Side-by-side Diff
include/linux/net.h
... | ... | @@ -129,11 +129,15 @@ |
129 | 129 | socket_state state; |
130 | 130 | short type; |
131 | 131 | unsigned long flags; |
132 | - const struct proto_ops *ops; | |
132 | + /* | |
133 | + * Please keep fasync_list & wait fields in the same cache line | |
134 | + */ | |
133 | 135 | struct fasync_struct *fasync_list; |
136 | + wait_queue_head_t wait; | |
137 | + | |
134 | 138 | struct file *file; |
135 | 139 | struct sock *sk; |
136 | - wait_queue_head_t wait; | |
140 | + const struct proto_ops *ops; | |
137 | 141 | }; |
138 | 142 | |
139 | 143 | struct vm_area_struct; |