Skip to content

Commit

Permalink
net: better pcpu data alignment
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
Eric Dumazet authored and David S. Miller committed Nov 8, 2011
1 parent 2bc8ca4 commit 8ce120f
Show file tree
Hide file tree
Showing 5 changed files with 5 additions and 5 deletions.
2 changes: 1 addition & 1 deletion drivers/net/veth.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
2 changes: 1 addition & 1 deletion net/ipv4/ip_gre.c
Original file line number Diff line number Diff line change
Expand Up @@ -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)
{
Expand Down
2 changes: 1 addition & 1 deletion net/ipv4/ipip.c
Original file line number Diff line number Diff line change
Expand Up @@ -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)
{
Expand Down
2 changes: 1 addition & 1 deletion net/ipv6/ip6_tunnel.c
Original file line number Diff line number Diff line change
Expand Up @@ -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)
{
Expand Down
2 changes: 1 addition & 1 deletion net/ipv6/sit.c
Original file line number Diff line number Diff line change
Expand Up @@ -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)
{
Expand Down

0 comments on commit 8ce120f

Please sign in to comment.