Eric Dumazet wrote:

Signed-off-by: Eric Dumazet <[EMAIL PROTECTED]>


------------------------------------------------------------------------

--- a/include/linux/netdevice.h 2006-02-07 11:55:42.000000000 +0100
+++ b/include/linux/netdevice.h 2006-02-09 09:23:15.000000000 +0100
@@ -649,6 +649,19 @@
        return test_bit(__LINK_STATE_START, &dev->state);
 }

One minor suggestion I would have is to just load jiffies once
(it is volatile). But it gets a little messy if you want to be
tricky and still load it zero times in the case that the first
test evaluates true. Maybe not worth the fuss.

{
    unsigned long now;
#ifndef CONFIG_SMP
    now = jiffies
#else
    if (!(dev->flags & IFF_SLAVE) || ((now = jiffies) == dev->last_rx))
        return;
#endif
    dev->last_rx = jiffies;
}

+static inline void netif_last_rx_update(struct net_device *dev)
+{
+#ifdef CONFIG_SMP
+       /*
+        * In order to avoid cache line ping pongs on last_rx, we check
+        * if the device is a slave,
+        * and if last_rx really has to be modified
+        */
+       if (!(dev->flags & IFF_SLAVE) || (dev->last_rx == jiffies))
+               return;
+#endif
+       dev->last_rx = jiffies;
+}

--
SUSE Labs, Novell Inc.
Send instant messages to your online friends http://au.messenger.yahoo.com
-
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Reply via email to