netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH net-next-2.6] net: add a comment on netdev->last_rx
@ 2010-08-31 17:40 Eric Dumazet
  2010-08-31 20:37 ` David Miller
  0 siblings, 1 reply; 2+ messages in thread
From: Eric Dumazet @ 2010-08-31 17:40 UTC (permalink / raw)
  To: David Miller; +Cc: netdev, Joe Perches

As some driver authors seem to reintroduce dev->last_rx use,
add a comment to strongly discourage this.

Since commit 6cf3f41e6c0 (bonding, net: Move last_rx update into bonding
recv logic), network drivers dont need to update last_rx themselves,
unless they use this field to implement a timeout.

Not updating last_rx helps not dirtying a cache line, improving
performance in SMP.

Signed-off-by: Eric Dumazet <eric.dumazet@gmail.com>
---
 include/linux/netdevice.h |    9 ++++++++-
 1 file changed, 8 insertions(+), 1 deletion(-)

diff --git a/include/linux/netdevice.h b/include/linux/netdevice.h
index 0cf9448..c82220a 100644
--- a/include/linux/netdevice.h
+++ b/include/linux/netdevice.h
@@ -953,7 +953,14 @@ struct net_device {
 /*
  * Cache line mostly used on receive path (including eth_type_trans())
  */
-	unsigned long		last_rx;	/* Time of last Rx	*/
+	unsigned long		last_rx;	/* Time of last Rx
+						 * This should not be set in
+						 * drivers, unless really needed,
+						 * because network stack (bonding)
+						 * use it if/when necessary, to
+						 * avoid dirtying this cache line.
+						 */
+
 	/* Interface address info used in eth_type_trans() */
 	unsigned char		*dev_addr;	/* hw address, (before bcast
 						   because most packets are



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

* Re: [PATCH net-next-2.6] net: add a comment on netdev->last_rx
  2010-08-31 17:40 [PATCH net-next-2.6] net: add a comment on netdev->last_rx Eric Dumazet
@ 2010-08-31 20:37 ` David Miller
  0 siblings, 0 replies; 2+ messages in thread
From: David Miller @ 2010-08-31 20:37 UTC (permalink / raw)
  To: eric.dumazet; +Cc: netdev, joe

From: Eric Dumazet <eric.dumazet@gmail.com>
Date: Tue, 31 Aug 2010 19:40:16 +0200

> As some driver authors seem to reintroduce dev->last_rx use,
> add a comment to strongly discourage this.
> 
> Since commit 6cf3f41e6c0 (bonding, net: Move last_rx update into bonding
> recv logic), network drivers dont need to update last_rx themselves,
> unless they use this field to implement a timeout.
> 
> Not updating last_rx helps not dirtying a cache line, improving
> performance in SMP.
> 
> Signed-off-by: Eric Dumazet <eric.dumazet@gmail.com>

Applied.

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

end of thread, other threads:[~2010-08-31 20:37 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2010-08-31 17:40 [PATCH net-next-2.6] net: add a comment on netdev->last_rx Eric Dumazet
2010-08-31 20:37 ` 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).