netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] af_packet: Avoid cache line dirtying
@ 2009-10-16 14:02 Eric Dumazet
  2009-10-20  8:07 ` David Miller
  0 siblings, 1 reply; 2+ messages in thread
From: Eric Dumazet @ 2009-10-16 14:02 UTC (permalink / raw)
  To: David S. Miller; +Cc: Linux Netdev List, Luca Deri

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: Eric Dumazet <eric.dumazet@gmail.com>
---

diff --git a/net/packet/af_packet.c b/net/packet/af_packet.c
index bf3a295..dac775e 100644
--- a/net/packet/af_packet.c
+++ b/net/packet/af_packet.c
@@ -188,7 +188,6 @@ struct packet_sock {
 	struct packet_ring_buffer	tx_ring;
 	int			copy_thresh;
 #endif
-	struct packet_type	prot_hook;
 	spinlock_t		bind_lock;
 	struct mutex		pg_vec_lock;
 	unsigned int		running:1,	/* prot_hook is attached*/
@@ -204,6 +203,7 @@ struct packet_sock {
 	unsigned int		tp_reserve;
 	unsigned int		tp_loss:1;
 #endif
+	struct packet_type	prot_hook ____cacheline_aligned_in_smp;
 };
 
 struct packet_skb_cb {

^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH] af_packet: Avoid cache line dirtying
  2009-10-16 14:02 [PATCH] af_packet: Avoid cache line dirtying Eric Dumazet
@ 2009-10-20  8:07 ` David Miller
  0 siblings, 0 replies; 2+ messages in thread
From: David Miller @ 2009-10-20  8:07 UTC (permalink / raw)
  To: eric.dumazet; +Cc: netdev, deri

From: Eric Dumazet <eric.dumazet@gmail.com>
Date: Fri, 16 Oct 2009 16:02:20 +0200

> 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: Eric Dumazet <eric.dumazet@gmail.com>

Applied.

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2009-10-20  8:07 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2009-10-16 14:02 [PATCH] af_packet: Avoid cache line dirtying Eric Dumazet
2009-10-20  8:07 ` David Miller

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).