Skip to content

Commit 8ce120f

Browse files
Eric Dumazetdavem330
authored andcommitted
net: better pcpu data alignment
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>
1 parent 2bc8ca4 commit 8ce120f

File tree

5 files changed

+5
-5
lines changed

5 files changed

+5
-5
lines changed

drivers/net/veth.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,8 +27,8 @@
2727

2828
struct veth_net_stats {
2929
u64 rx_packets;
30-
u64 tx_packets;
3130
u64 rx_bytes;
31+
u64 tx_packets;
3232
u64 tx_bytes;
3333
u64 rx_dropped;
3434
struct u64_stats_sync syncp;

net/ipv4/ip_gre.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -171,7 +171,7 @@ struct pcpu_tstats {
171171
unsigned long rx_bytes;
172172
unsigned long tx_packets;
173173
unsigned long tx_bytes;
174-
};
174+
} __attribute__((aligned(4*sizeof(unsigned long))));
175175

176176
static struct net_device_stats *ipgre_get_stats(struct net_device *dev)
177177
{

net/ipv4/ipip.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -148,7 +148,7 @@ struct pcpu_tstats {
148148
unsigned long rx_bytes;
149149
unsigned long tx_packets;
150150
unsigned long tx_bytes;
151-
};
151+
} __attribute__((aligned(4*sizeof(unsigned long))));
152152

153153
static struct net_device_stats *ipip_get_stats(struct net_device *dev)
154154
{

net/ipv6/ip6_tunnel.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -93,7 +93,7 @@ struct pcpu_tstats {
9393
unsigned long rx_bytes;
9494
unsigned long tx_packets;
9595
unsigned long tx_bytes;
96-
};
96+
} __attribute__((aligned(4*sizeof(unsigned long))));
9797

9898
static struct net_device_stats *ip6_get_stats(struct net_device *dev)
9999
{

net/ipv6/sit.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -91,7 +91,7 @@ struct pcpu_tstats {
9191
unsigned long rx_bytes;
9292
unsigned long tx_packets;
9393
unsigned long tx_bytes;
94-
};
94+
} __attribute__((aligned(4*sizeof(unsigned long))));
9595

9696
static struct net_device_stats *ipip6_get_stats(struct net_device *dev)
9797
{

0 commit comments

Comments
 (0)