Skip to contentSkip to conversation

net: align pcpu_sw_netstats and pcpu_lstats structs

PATCH Applied Eric Dumazet 2 participants 2 messages Nov 17, 2018 – Nov 18, 2018

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 net: align pcpu_sw_netstats and pcpu_lstats structs

Do not risk spanning these small structures on two cache lines, it is absolutely not worth it.

For 32bit arches, the hint might not be enough, but we do not really care anymore.

---
 include/linux/netdevice.h | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
include/linux/netdevice.h +2 -2
index 917ae7b6263e4686ac7af4d16445f4e996001ea6..086e64d885971ff04f186d488975b3305a0fbb1d 100644
@@ -2389,13 +2389,13 @@ struct pcpu_sw_netstats {
 	u64     tx_packets;
 	u64     tx_bytes;
 	struct u64_stats_sync   syncp;
-};
+} __aligned(4 * sizeof(u64));
 
 struct pcpu_lstats {
 	u64 packets;
 	u64 bytes;
 	struct u64_stats_sync syncp;
-};
+} __aligned(2 * sizeof(u64));
 
 #define __netdev_alloc_pcpu_stats(type, gfp)				\
 ({									\
Signature · 1 line
2.19.1.1215.g8438c0b245-goog
maintainer Applied
#1 lore raw

From: Eric Dumazet <[email protected]>
Date: Fri, 16 Nov 2018 07:24:24 -0800

Quoted 7 lines

Do not risk spanning these small structures on two cache lines, it is absolutely not worth it.

For 32bit arches, the hint might not be enough, but we do not really care anymore.

Applied.