Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

net: reorganize fields in netns_mib

Order fields to increase locality for most used protocols.

udplite and icmp are moved at the end.

Same for proc_net_devsnmp6 which is not used in fast path.

This potentially saves one cache line miss for typical TCP/UDP over IPv4/IPv6.

Signed-off-by: Eric Dumazet <edumazet@google.com>
Signed-off-by: David S. Miller <davem@davemloft.net>

authored by

Eric Dumazet and committed by
David S. Miller
7f040aa3 ca4d4c34

+22 -12
+22 -12
include/net/netns/mib.h
··· 5 5 #include <net/snmp.h> 6 6 7 7 struct netns_mib { 8 - DEFINE_SNMP_STAT(struct tcp_mib, tcp_statistics); 9 8 DEFINE_SNMP_STAT(struct ipstats_mib, ip_statistics); 10 - DEFINE_SNMP_STAT(struct linux_mib, net_statistics); 11 - DEFINE_SNMP_STAT(struct udp_mib, udp_statistics); 12 - DEFINE_SNMP_STAT(struct udp_mib, udplite_statistics); 13 - DEFINE_SNMP_STAT(struct icmp_mib, icmp_statistics); 14 - DEFINE_SNMP_STAT_ATOMIC(struct icmpmsg_mib, icmpmsg_statistics); 15 - 16 9 #if IS_ENABLED(CONFIG_IPV6) 17 - struct proc_dir_entry *proc_net_devsnmp6; 18 - DEFINE_SNMP_STAT(struct udp_mib, udp_stats_in6); 19 - DEFINE_SNMP_STAT(struct udp_mib, udplite_stats_in6); 20 10 DEFINE_SNMP_STAT(struct ipstats_mib, ipv6_statistics); 21 - DEFINE_SNMP_STAT(struct icmpv6_mib, icmpv6_statistics); 22 - DEFINE_SNMP_STAT_ATOMIC(struct icmpv6msg_mib, icmpv6msg_statistics); 23 11 #endif 12 + 13 + DEFINE_SNMP_STAT(struct tcp_mib, tcp_statistics); 14 + DEFINE_SNMP_STAT(struct linux_mib, net_statistics); 15 + 16 + DEFINE_SNMP_STAT(struct udp_mib, udp_statistics); 17 + #if IS_ENABLED(CONFIG_IPV6) 18 + DEFINE_SNMP_STAT(struct udp_mib, udp_stats_in6); 19 + #endif 20 + 24 21 #ifdef CONFIG_XFRM_STATISTICS 25 22 DEFINE_SNMP_STAT(struct linux_xfrm_mib, xfrm_statistics); 26 23 #endif ··· 26 29 #endif 27 30 #ifdef CONFIG_MPTCP 28 31 DEFINE_SNMP_STAT(struct mptcp_mib, mptcp_statistics); 32 + #endif 33 + 34 + DEFINE_SNMP_STAT(struct udp_mib, udplite_statistics); 35 + #if IS_ENABLED(CONFIG_IPV6) 36 + DEFINE_SNMP_STAT(struct udp_mib, udplite_stats_in6); 37 + #endif 38 + 39 + DEFINE_SNMP_STAT(struct icmp_mib, icmp_statistics); 40 + DEFINE_SNMP_STAT_ATOMIC(struct icmpmsg_mib, icmpmsg_statistics); 41 + #if IS_ENABLED(CONFIG_IPV6) 42 + DEFINE_SNMP_STAT(struct icmpv6_mib, icmpv6_statistics); 43 + DEFINE_SNMP_STAT_ATOMIC(struct icmpv6msg_mib, icmpv6msg_statistics); 44 + struct proc_dir_entry *proc_net_devsnmp6; 29 45 #endif 30 46 }; 31 47