datapath: Don't set dev->last_rx on kernels >= 2.6.29.
authorJesse Gross <jesse@nicira.com>
Wed, 24 Nov 2010 00:46:47 +0000 (16:46 -0800)
committerJesse Gross <jesse@nicira.com>
Fri, 3 Dec 2010 01:10:16 +0000 (17:10 -0800)
dev->last_rx is used for rebalancing in Linux bonding.  However,
on a SMP machine it quickly becomes a very hot cacheline.  On
kernels 2.6.29 and later the networking core will update last_rx
only if bonding is in use, so drivers do not need to set it at all.

Signed-off-by: Jesse Gross <jesse@nicira.com>
Acked-by: Ben Pfaff <blp@nicira.com>
datapath/vport-internal_dev.c

index ec0052c..527131d 100644 (file)
@@ -12,6 +12,7 @@
 #include <linux/ethtool.h>
 #include <linux/rcupdate.h>
 #include <linux/skbuff.h>
+#include <linux/version.h>
 
 #include "datapath.h"
 #include "vport-generic.h"
@@ -273,7 +274,10 @@ static int internal_dev_recv(struct vport *vport, struct sk_buff *skb)
                netif_rx(skb);
        else
                netif_rx_ni(skb);
+
+#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,29)
        netdev->last_rx = jiffies;
+#endif
 
        return len;
 }