提交 94b05952 编写于 作者: E Eric Dumazet 提交者: David S. Miller

af_packet: Avoid cache line dirtying

While doing multiple captures, I found af_packet was dirtying cache line
containing its prot_hook.

This slow down machines where several cpus are necessary to handle capture
traffic, as each prot_hook is traversed for each packet coming in or out
the host.

This patches moves "struct packet_type prot_hook" to the end of
packet_sock, and uses a ____cacheline_aligned_in_smp to make sure
this remains shared by all cpus.
Signed-off-by: NEric Dumazet <eric.dumazet@gmail.com>
Signed-off-by: NDavid S. Miller <davem@davemloft.net>
上级 7b6856a0
...@@ -188,7 +188,6 @@ struct packet_sock { ...@@ -188,7 +188,6 @@ struct packet_sock {
struct packet_ring_buffer tx_ring; struct packet_ring_buffer tx_ring;
int copy_thresh; int copy_thresh;
#endif #endif
struct packet_type prot_hook;
spinlock_t bind_lock; spinlock_t bind_lock;
struct mutex pg_vec_lock; struct mutex pg_vec_lock;
unsigned int running:1, /* prot_hook is attached*/ unsigned int running:1, /* prot_hook is attached*/
...@@ -204,6 +203,7 @@ struct packet_sock { ...@@ -204,6 +203,7 @@ struct packet_sock {
unsigned int tp_reserve; unsigned int tp_reserve;
unsigned int tp_loss:1; unsigned int tp_loss:1;
#endif #endif
struct packet_type prot_hook ____cacheline_aligned_in_smp;
}; };
struct packet_skb_cb { struct packet_skb_cb {
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册