net: better pcpu data alignment
authorEric Dumazet <eric.dumazet@gmail.com>
Fri, 4 Nov 2011 23:19:28 +0000 (23:19 +0000)
committerDavid S. Miller <davem@davemloft.net>
Tue, 8 Nov 2011 20:10:59 +0000 (15:10 -0500)
Tunnels can force an alignment of their percpu data to reduce number of
cache lines used in fast path, or read in .ndo_get_stats()

percpu_alloc() is a very fine grained allocator, so any small hole will
be used anyway.

Signed-off-by: Eric Dumazet <eric.dumazet@gmail.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
drivers/net/veth.c
net/ipv4/ip_gre.c
net/ipv4/ipip.c
net/ipv6/ip6_tunnel.c
net/ipv6/sit.c

index ef883e97cee08a557fd3dcc2546535c1ca487372..726c790ec74c76c581ebdf34669e3fd2e1915129 100644 (file)
@@ -27,8 +27,8 @@
 
 struct veth_net_stats {
        u64                     rx_packets;
-       u64                     tx_packets;
        u64                     rx_bytes;
+       u64                     tx_packets;
        u64                     tx_bytes;
        u64                     rx_dropped;
        struct u64_stats_sync   syncp;
index d55110e9312023bdba81a9643b727ada7be06fee..38f7c07d12ab632b538626ea6226bf8267b1e643 100644 (file)
@@ -171,7 +171,7 @@ struct pcpu_tstats {
        unsigned long   rx_bytes;
        unsigned long   tx_packets;
        unsigned long   tx_bytes;
-};
+} __attribute__((aligned(4*sizeof(unsigned long))));
 
 static struct net_device_stats *ipgre_get_stats(struct net_device *dev)
 {
index 065effd8349a81689828927c84142a778aebb650..94906908a416dc278b2fb204a3112e0bd7f894dd 100644 (file)
@@ -148,7 +148,7 @@ struct pcpu_tstats {
        unsigned long   rx_bytes;
        unsigned long   tx_packets;
        unsigned long   tx_bytes;
-};
+} __attribute__((aligned(4*sizeof(unsigned long))));
 
 static struct net_device_stats *ipip_get_stats(struct net_device *dev)
 {
index bdc15c9003d781fbdb3d0288cf8b88aa84f71742..f36ca13975135e08d29a7ee03ddc2bbd5f013f18 100644 (file)
@@ -93,7 +93,7 @@ struct pcpu_tstats {
        unsigned long   rx_bytes;
        unsigned long   tx_packets;
        unsigned long   tx_bytes;
-};
+} __attribute__((aligned(4*sizeof(unsigned long))));
 
 static struct net_device_stats *ip6_get_stats(struct net_device *dev)
 {
index a7a18602a046e1ffe5f0f00883844459802f4a25..cec09382282d30e0bd0f606c7caae125ea59f1dc 100644 (file)
@@ -91,7 +91,7 @@ struct pcpu_tstats {
        unsigned long   rx_bytes;
        unsigned long   tx_packets;
        unsigned long   tx_bytes;
-};
+} __attribute__((aligned(4*sizeof(unsigned long))));
 
 static struct net_device_stats *ipip6_get_stats(struct net_device *dev)
 {